lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526091903.587-1-vulab@iscas.ac.cn>
Date: Mon, 26 May 2025 17:19:03 +0800
From: Wentao Liang <vulab@...as.ac.cn>
To: johannes@...solutions.net,
	luciano.coelho@...el.com
Cc: linux-wireless@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Wentao Liang <vulab@...as.ac.cn>,
	stable@...r.kernel.org
Subject: [PATCH v2] mac80211: Add null pointer check for ieee80211_link_get_chanctx()

The function ieee80211_chsw_switch_vifs() calls the function
ieee80211_link_get_chanctx(), but does not check its return value.
The return value is a null pointer if the ieee80211_link_get_chanctx()
fails. This will lead to a null pointer dereference in the following
code "&old_ctx->conf". A proper implementation can be found in
ieee80211_link_use_reserved_assign().

Add a null pointer check and goto error handling path if the
function fails.

Fixes: 5d52ee811019 ("mac80211: allow reservation of a running chanctx")
Cc: stable@...r.kernel.org # v3.16
Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
---
v2: Fix code error.

 net/mac80211/chan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index a442cb667520..c9b703c283e7 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1503,6 +1503,10 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
 				continue;
 
 			old_ctx = ieee80211_link_get_chanctx(link);
+			if (WARN_ON(!old_ctx)) {
+				err = -EINVAL;
+				goto out;
+			}
 			vif_chsw[i].vif = &link->sdata->vif;
 			vif_chsw[i].old_ctx = &old_ctx->conf;
 			vif_chsw[i].new_ctx = &ctx->conf;
-- 
2.42.0.windows.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ