Re: sys/cnmac: fix command buffer leak on transmit failure

Kirill A. Korinsky <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
On Thu, 09 Jul 2026 16:22:51 +0200,
Visa Hankala <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.