From owner-freebsd-current@FreeBSD.ORG Thu Mar 26 20:12:55 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 208F1125 for ; Thu, 26 Mar 2015 20:12:55 +0000 (UTC) Received: from forward3l.mail.yandex.net (forward3l.mail.yandex.net [IPv6:2a02:6b8:0:1819::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A64EC206 for ; Thu, 26 Mar 2015 20:12:54 +0000 (UTC) Received: from smtp14.mail.yandex.net (smtp14.mail.yandex.net [95.108.131.192]) by forward3l.mail.yandex.net (Yandex) with ESMTP id 0069D15010FA; Thu, 26 Mar 2015 23:12:42 +0300 (MSK) Received: from smtp14.mail.yandex.net (localhost [127.0.0.1]) by smtp14.mail.yandex.net (Yandex) with ESMTP id 7E0FE1B608B7; Thu, 26 Mar 2015 23:12:42 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:4::a]) by smtp14.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RnL1L2ciKe-CfGe8wmv; Thu, 26 Mar 2015 23:12:42 +0300 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1427400762; bh=HuMIOlj1cppZwJMulUHYhhZcp/VqsiNiS1CItFaf6YM=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type; b=ZPHFv4km8dZAQaRAPXC5wd3x0aSj52D6C6kIW6EhwDwS34Nec2G0vpA/rMd+sCUBx nIsc4ZkYBY2Y2e1qXkitan1LFo5c2Rc5UWZG8e/Fdsb8m6llBiHsgpcDMNW4/YPU20 Ah9lCGWaQ9OShG8J0f/awQPEExsdb0XeLdSkfOkg= Authentication-Results: smtp14.mail.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <551467C9.3000103@yandex.ru> Date: Thu, 26 Mar 2015 23:10:49 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Alexandre Martins , freebsd-current@freebsd.org Subject: Re: Mbuf leak in if_lagg.c References: <1708955.mQ2X6OUmTD@pc-alex> <55146124.2070501@yandex.ru> In-Reply-To: <55146124.2070501@yandex.ru> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CeMp2gjn6qptS0PahBrTD449kw4W6sLov" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2015 20:12:55 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CeMp2gjn6qptS0PahBrTD449kw4W6sLov Content-Type: multipart/mixed; boundary="------------020207000908040202050902" This is a multi-part message in MIME format. --------------020207000908040202050902 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 26.03.2015 22:42, Andrey V. Elsukov wrote: >> If lp_detaching is non 0, the mbuf pointer is set to NULL without m_fr= eem it. >> >> Can you look at this ? >=20 > Hi, >=20 > what you thing about this patch? > lp_detaching can be non zero in case of parent interface departure. > So I don't see the reason to call ETHER_BPF_MTAP() in this case. Now I see the reason - to capture all received packets before interface departure. New is attached. --=20 WBR, Andrey V. Elsukov --------------020207000908040202050902 Content-Type: text/x-patch; name="if_lagg.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="if_lagg.diff" Index: if_lagg.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- if_lagg.c (revision 280234) +++ if_lagg.c (working copy) @@ -1669,7 +1669,11 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) =20 ETHER_BPF_MTAP(scifp, m); =20 - m =3D (lp->lp_detaching =3D=3D 0) ? lagg_proto_input(sc, lp, m) : NULL;= + if (lp->lp_detaching !=3D 0) { + m_freem(m); + m =3D NULL; + } else + m =3D lagg_proto_input(sc, lp, m); =20 if (m !=3D NULL) { if (scifp->if_flags & IFF_MONITOR) { --------------020207000908040202050902-- --CeMp2gjn6qptS0PahBrTD449kw4W6sLov Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVFGfJAAoJEAHF6gQQyKF6sBQIAJPbquAklzNGt/UBGDprzB/u N+pVkZE513HKj4gdeAYj1VNiWnjA9EcR1RlAPgjpm+AAXmf9uAS9JRPg24ZF8Fnw S881jtKkDaxUcJC3cgszJsxvvwAM0Y8IMU0GL/rMHGQ3Sbmw+rof/H4lgyQyvnBJ 8617Ke+cqFNYk0krhusi2hC/mmYgfuEjmIv8bZx6ouXdobisPNNyAsdtqHPBRNLM AioWFg1btVu1JsQ9JwuKoXDaTgoLggKaZs/nq+tyqgnKAjE/H/MKYdFn/LoH8+Jg eMATepOJoz7Qci85H43ud+bzN9LXAkFxt6ucMfC5RVSfYRCeRVFQJre8TQiAYIg= =NLZk -----END PGP SIGNATURE----- --CeMp2gjn6qptS0PahBrTD449kw4W6sLov--