Linux-Wireless Archive on
 help / color / Atom feed
From: "Stefan Bühler" <>
To: Johannes Berg <>
	"Stefan Bühler" <>
Subject: [PATCH] cfg80211: fix double-free after changing network namespace
Date: Tue, 26 Nov 2019 11:05:44 +0100
Message-ID: <> (raw)

From: Stefan Bühler <>

If wdev->wext.keys was initialized it didn't get reset to NULL on
unregister (and it doesn't get set in cfg80211_init_wdev either), but
wdev is reused if unregister was triggered through

The next unregister (for whatever reason) will try to free
wdev->wext.keys again.

Signed-off-by: Stefan Bühler <>
 net/wireless/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 350513744575..3e25229a059d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1102,6 +1102,7 @@ static void __cfg80211_unregister_wdev(struct wireless_dev *wdev, bool sync)
 #ifdef CONFIG_CFG80211_WEXT
+	wdev->wext.keys = NULL;
 	/* only initialized if we have a netdev */
 	if (wdev->netdev)

             reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 10:05 Stefan Bühler [this message]
2019-11-26 10:12 ` Stefan Bühler
2019-11-26 15:55   ` Kalle Valo
2019-12-04  8:26 ` Stefan Bühler
2019-12-04  8:50   ` Johannes Berg

Reply instructions:

You may reply publically 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:

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

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Wireless Archive on

Archives are clonable:
	git clone --mirror linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ \
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone