From nobody Sun Jun 5 18:11:38 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C57601BEADF0; Sun, 5 Jun 2022 18:11:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LGPp22SwJz3Dft; Sun, 5 Jun 2022 18:11:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654452698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lUS9iFvfnsRXh/Krnawdmv5REUbuapbmmavF3pSTK3E=; b=aavfh7wx0MFlscfQx7zoECBT/KN51WYbP0Oz2ZO6fx1t0lDgjhsh8tU+EqVH6eJ8VSwjkk bSGTR2essh/qPcInk/kxp32hqe/ZzrOIwfYe5zyA4sQblYQtk+fvc4i3k8YnKUpd70uvWd ctyjEYgIZvLuig+l+a+Wdo2x/vZXUw6mfjns2ceXUbQoj/WXwz0kCloFnR7xVh7pN8LrM6 Z1vtp4WHJLdORsS8NantFFSlYKaQVRbrzGqIifaeQV40e0Cncto5CKenKXFccnMhYan0xs 5PoOUKRsHG+G2IKGZnHxcMr/YJT7+8KfmPpA6mrWRWoON3ZUKRPjxH7+1TNKPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20FE316D29; Sun, 5 Jun 2022 18:11:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 255IBc5Q037857; Sun, 5 Jun 2022 18:11:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 255IBc3o037856; Sun, 5 Jun 2022 18:11:38 GMT (envelope-from git) Date: Sun, 5 Jun 2022 18:11:38 GMT Message-Id: <202206051811.255IBc3o037856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: dbc06dd98ae9 - main - LinuxKPI: 802.11 plug mbuf leak in error cases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbc06dd98ae9940377a9ef31a594c17566334977 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654452698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lUS9iFvfnsRXh/Krnawdmv5REUbuapbmmavF3pSTK3E=; b=pkygXrjYmVyWMqqiXy8X6+IwI491C3GhOJTF5wnlf7PmbnCstBq2uH6HuI7KkBAe5hsx0f jj492oBjHs5cJvAeeGFvaT1IltveM83DgzahTcsujVKYuw4kgoaIPVzurWvzSku8eMv5AD zPXBjPHDwlm4hGFrbaU9xy5HJ/Qr5GwzyaMKG9vG+pVSKspE7znMfH5AQjm3End+/i8IoA +/DeGvEi8caFrPCuprpmxzxMXyUMIHOYBW9DVMt8h+JhZMplK4vUswlu/30LVljr2abZ8z d9bK8ItxsUrj6viIkGCIoucScVMUzkSkeRuWZ1rhOm4VsBnBqpzNQvbxeFQxmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654452698; a=rsa-sha256; cv=none; b=dUVFRcLXEYuRLvTaQAl4J9qPI39U8tnq1/40+Iz6a+3uWKznyZFaro6l523OvxstwQcMgG EIvMTpMhqObk64/ddmbaEDl5t2w3+PO5Vy96Oqhvxytwvz2fdvr25TknL/qxlno6WCcmhk LNlsRC3SpH4nFz8qXBjS5c+ixFJbPreNFgGClMbhttdESkMvCFCbcisO8K7VD6ar0UWRzN l+6urIOZ8J0BVKeUJ6r6w2GsGugxjDeHkZSLb0+8KRBXNFeu7Ux2huqpTjGtIF1OuPFMx+ KeO/SB7JpQdzUZ3EbQ0nc5RocXlzddHpvL5XIbFjLQIviKqQS2cgM0UgA0avqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=dbc06dd98ae9940377a9ef31a594c17566334977 commit dbc06dd98ae9940377a9ef31a594c17566334977 Author: Bjoern A. Zeeb AuthorDate: 2022-06-05 18:04:57 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-06-05 18:10:24 +0000 LinuxKPI: 802.11 plug mbuf leak in error cases Manually free the mbuf in certain error cases from net80211 to not leak it. Note that the differences between ieee80211_input_mimo() and ieee80211_input_mimo_all(), the former not consuming the mbuf while the later does, is confusing. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 6d67c29ed7a6..f2a5d6dac706 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3870,6 +3870,7 @@ no_trace_beacons: ok = ieee80211_add_rx_params(m, &rx_stats); if (ok == 0) { + m_freem(m); counter_u64_add(ic->ic_ierrors, 1); goto err; } @@ -3960,8 +3961,11 @@ skip_device_ts: if (ni != NULL) { ok = ieee80211_input_mimo(ni, m); ieee80211_free_node(ni); + if (ok < 0) + m_freem(m); } else { ok = ieee80211_input_mimo_all(ic, m); + /* mbuf got consumed. */ } NET_EPOCH_EXIT(et);