tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: possible mbuf leak in tap_dev_close()



On Sun, 29 Nov 2009, Paul Forgey wrote:

> In the NetBSD Current sources downloaded Nov 20, I noticed a potential
> mbuf leak in the tap driver if the character device is closed with
> unread packets.

I have fixed it, thanks for the report.

- I did not remove the empty-list check, that could go but it is an
  unrelated style change.

- Also, m_freem() should be used to release the chain as a packet is often
  spread out over several mbufs

iain


Index: if_tap.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_tap.c,v
retrieving revision 1.59
diff -u -r1.59 if_tap.c
--- if_tap.c    15 Sep 2009 19:38:15 -0000      1.59
+++ if_tap.c    29 Nov 2009 10:17:04 -0000
@@ -859,6 +859,7 @@
                        if (ifp->if_bpf)
                                bpf_mtap(ifp->if_bpf, m);
 #endif
+                       m_freem(m);
                }
        }
        splx(s);




Home | Main Index | Thread Index | Old Index