linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ethan Tidmore <ethantidmore06@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH] wifi: cfg80211: Fix error pointer dereference in nl80211_pre_doit()
Date: Thu, 15 Oct 2026 10:22:08 -0500	[thread overview]
Message-ID: <20261015152208.351083-1-ethantidmore06@gmail.com> (raw)

nl80211_lock_and_recheck() can return an ERR_PTR on failure. If this
happens, 'wdev' holds an error pointer that bypasses the non-NULL
check at 'out' and gets passed into wdev_put(), resulting in a
dereference. Clear 'wdev' to NULL before jumping to 'out' to prevent
this.

Fixes: 8e3d9039d280 ("wifi: nl80211: avoid rtnl for commands that don't want it")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 net/wireless/nl80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d790e204aee3..7a5f7000fbaa 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -20192,6 +20192,7 @@ static int nl80211_pre_doit(const struct genl_split_ops *ops,
 			wdev = nl80211_lock_and_recheck(rdev, netns, wdev_id);
 			if (IS_ERR(wdev)) {
 				err = PTR_ERR(wdev);
+				wdev = NULL;
 				goto out;
 			}
 		}
-- 
Thanks,
ET
https://github.com/sponsors/ethantidmore


                 reply	other threads:[~2026-10-15 15:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261015152208.351083-1-ethantidmore06@gmail.com \
    --to=ethantidmore06@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).