Skip to content

Commit 8f815cd

Browse files
Dmitry Ivanovjmberg-intel
authored andcommitted
nl80211: check netlink protocol in socket release notification
A non-privileged user can create a netlink socket with the same port_id as used by an existing open nl80211 netlink socket (e.g. as used by a hostapd process) with a different protocol number. Closing this socket will then lead to the notification going to nl80211's socket release notification handler, and possibly cause an action such as removing a virtual interface. Fix this issue by checking that the netlink protocol is NETLINK_GENERIC. Since generic netlink has no notifier chain of its own, we can't fix the problem more generically. Fixes: 026331c ("cfg80211/mac80211: allow registering for and sending action frames") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Ivanov <dima@ubnt.com> [rewrite commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 30d237a commit 8f815cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/wireless/nl80211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13216,7 +13216,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
1321613216
struct wireless_dev *wdev;
1321713217
struct cfg80211_beacon_registration *reg, *tmp;
1321813218

13219-
if (state != NETLINK_URELEASE)
13219+
if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
1322013220
return NOTIFY_DONE;
1322113221

1322213222
rcu_read_lock();

0 commit comments

Comments
 (0)