Skip to contentSkip to conversation

Check protocol number in nl80211 netlink socket release notification handler.

PATCH Applied Dmitry Ivanov 2 participants 2 messages Apr 6, 2016 – Apr 7, 2016 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Check protocol number in nl80211 netlink socket release notification handler.

This patch corrects the problem where non-privileged user can create netlink socket with the same port_id as used by hostapd but different protocol number. Upon close() or process termination, a notification is sent to nl80211 subsystem which will destroy virtual wireless network interfaces created by hostapd like it just died but in fact hostapd is still running. This is possible because port_id is unique within particular protocol number only.

Fixes 026331c4d9b5 ("cfg80211/mac80211: allow registering for and sending action frames")
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
index 98c9242..056a730 100644
@@ -13216,7 +13216,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
 	struct wireless_dev *wdev;
 	struct cfg80211_beacon_registration *reg, *tmp;
 
-	if (state != NETLINK_URELEASE)
+	if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
 		return NOTIFY_DONE;
 
 	rcu_read_lock();
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw
Quoted 12 lines · Dmitry Ivanov

This patch corrects the problem where non-privileged user can create netlink socket with the same port_id as used by hostapd but different protocol number. Upon close() or process termination, a notification is
sent  to nl80211 subsystem which will destroy virtual wireless network
interfaces created by hostapd like it just died but in fact hostapd is
still running. This is possible because port_id is unique within particular
protocol number only.

Applied.

johannes