Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: sys/cnmac: fix command buffer leak on transmit failure
To:
Visa Hankala <visa@hankala.org>
Cc:
tech@openbsd.org
Date:
Thu, 09 Jul 2026 17:55:03 +0200

Download raw body.

Thread
On Thu, 09 Jul 2026 16:22:51 +0200,
Visa Hankala <visa@hankala.org> wrote:
> 
> On Thu, Jul 09, 2026 at 12:28:47AM +0200, Kirill A. Korinsky wrote:
> > visa@,
> > 
> > my ER-4 whcih I used as router had reached interesting state: it floods
> > errors like this:
> > 
> > Jun 30 11:11:39 gw /bsd: cnmac2: cannot allocate command buffer from free pool allocator
> > Jun 30 11:11:39 gw /bsd: cnmac2: failed to transmit packet
> > Jun 30 11:11:40 gw /bsd: cnmac2: cannot allocate command buffer from free pool allocator
> > Jun 30 11:11:40 gw /bsd: cnmac2: failed to transmit packet
> > 
> > tons of them, I have no idea what had happened before I discovered it in
> > that state, but device was ok via serial, but network was dead.
> > 
> > After reading code near that error I think I had spotted a leak.
> 
> It seems to me that there is no leak in the code. The local cmdptr
> pointer is derived using cmdptr_idx and discarded when the function
> returns. cnmac_send_cmd() updates cmdptr_idx only if it was able to
> add the command words to the queue.
> 

Do you have any idea why it had exploded?

-- 
wbr, Kirill