From nobody Wed Jun 08 17:07:09 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 A3052831BAB; Wed, 8 Jun 2022 17:07:10 +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 4LJDDG12tTz4lDq; Wed, 8 Jun 2022 17:07:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708030; 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=adBwP2o6aFwp4j5UB3zBRBIZEBnISKWEsLCbYvmpBGs=; b=gESqqqx7E7WX1t/+CSmokvG+1nhqaM7q6LrTbFQ37pniJqd90sqMJIcU6+ZRhBpSI+tt8n KNa0adV9e7RShywwgAmzi6a/1NHxPSqCwgIwZeHQf6kTXnjmS8o2p79iaO/s7VnncFCqPL LP0V7dPLMP7DX3qR21cBDMi2iDdDWCllO4Vt2hLk43Oh03/WLH4Yt8PaCpnvexfW0e+Wzp 2dM//R8vDIFoW4bVBGZakv+SzG8JYLB1KiYE41181HjNiq11c/oHb4kiMzfBUKCbbA0SrU 1ExrG0QBfJCaGK8rGRTcW78Mh5yQxtE+ED9OY6UMFcH5J4gYdt/lnJv7leO5cg== 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 ABE95138F8; Wed, 8 Jun 2022 17:07:09 +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 258H79hj089028; Wed, 8 Jun 2022 17:07:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 258H79DN089027; Wed, 8 Jun 2022 17:07:09 GMT (envelope-from git) Date: Wed, 8 Jun 2022 17:07:09 GMT Message-Id: <202206081707.258H79DN089027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b84aea440bf8 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b84aea440bf8a4bd6b0899ad9b3303c80cf4d971 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708030; 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=adBwP2o6aFwp4j5UB3zBRBIZEBnISKWEsLCbYvmpBGs=; b=d8PYp/EXlobzZsLUT5GDatGwchrHe2HsWQCkiGFYtioNZYfHVrrhK48of0KFC3F+GBuS+0 +gbqKqTD21fmdJF23VxtVeoEGFNehPcV2oy66lfgzms+IOUyTPzOWcv1NEXwIPrkESq8Lt pKNFmOse3FhrnjvkTOcnulolVoK1NPJF/qjlOsk4wrx3xvSLpMBk1Pqn0xm9lBoQcA/NAU lJyEuzi/DPkao0bUq95YMNcj4kwcIHcGDRAAPv4j59HCK+T8GI6ON3d8nlOp5CswFRucCl FsfNLocYXI2yBX5kazC/w4kMhMeTWWqX5pm5YcTFh0jVYz4X8umFC7HxdercAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654708030; a=rsa-sha256; cv=none; b=XQL9nzDBds5KJN6YsgFyqr73HhLFGX858w3VkIP2IrbZvMFiSyn/tNnXmBWEZsmxo2kPC8 1s/YMOx6HWCXGhRSqgfK3QqfIlhZR79xtQfUr1pP9ysD5aAehFWzGKq+yhOQquVNhq1XeZ GFaWjLjrTVWrj9tn46kVE6iqlX/sHapUYYKHqqi3afiD609pspIA2U/XsMbNlIJHUyph78 CMtr6sUp3bafGT4Qs83LWp8QT+es/U1KIUF7e9IVaxC4E8ZL/N/wkpN4rCEaU7oVxtHep/ 5aqXiKJ7sx6gyjOi2ydGJbg1WqHsMlAnp/lAvZG7tWgzctut4Po+3clL509wdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b84aea440bf8a4bd6b0899ad9b3303c80cf4d971 commit b84aea440bf8a4bd6b0899ad9b3303c80cf4d971 Author: Bjoern A. Zeeb AuthorDate: 2022-06-05 18:04:57 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-06-08 16:11:19 +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 (cherry picked from commit dbc06dd98ae9940377a9ef31a594c17566334977) --- 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 27141829839f..82467d932054 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);