From owner-freebsd-stable@FreeBSD.ORG Mon Dec 27 11:24:52 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD28716A4CE for ; Mon, 27 Dec 2004 11:24:52 +0000 (GMT) Received: from nic.cafax.se (nic.cafax.se [192.71.228.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62B2943D2D for ; Mon, 27 Dec 2004 11:24:51 +0000 (GMT) (envelope-from bygg@cafax.se) Received: from nic.cafax.se (localhost [127.0.0.1]) by nic.cafax.se (8.12.11/8.12.11) with ESMTP id iBRBOnfZ027375 for ; Mon, 27 Dec 2004 12:24:49 +0100 (MET) Received: (from bygg@localhost) by nic.cafax.se (8.12.11/8.12.11/Submit) id iBRBOnug009941 for freebsd-stable@freebsd.org; Mon, 27 Dec 2004 12:24:49 +0100 (MET) Date: Mon, 27 Dec 2004 12:24:49 WET From: Johnny Eriksson To: freebsd-stable@freebsd.org Message-ID: Subject: mbuf leak in bpf.c X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Dec 2004 11:24:52 -0000 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