Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Dec 2004 12:24:49 WET
From:      Johnny Eriksson <bygg@cafax.se>
To:        freebsd-stable@freebsd.org
Subject:   mbuf leak in bpf.c
Message-ID:  <CMM.0.91.0.1104146689.bygg@nic.cafax.se>

next in thread | raw e-mail | index | archive | help
If one tries to write a datagram to a bpf device, and the datagram is
longer than the MTU on the physical interface, the write fails as it
should, but an mbuf is allocated and thrown away.  Proposed solution:

--- bpf.c.orig  Mon Dec 27 10:43:06 2004
+++ bpf.c       Mon Dec 27 10:44:16 2004
@@ -633,8 +633,10 @@
        if (error)
                return (error);
 
-       if (datlen > ifp->if_mtu)
+       if (datlen > ifp->if_mtu) {
+               m_freem(m);
                return (EMSGSIZE);
+       }
 
        if (d->bd_hdrcmplt)
                dst.sa_family = pseudo_AF_HDRCMPLT;

--Johnny



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CMM.0.91.0.1104146689.bygg>