Skip to contentSkip to conversation

cfg80211: Don't allow users to create/remove interfaces

PATCH In review Michael Buesch 2 participants 2 messages Jul 10, 2007 – Jul 11, 2007 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: Don't allow users to create/remove interfaces

This adds a capability check to only allow creation and removal of interfaces by a network admin.

Cc Johannes Berg <[email protected]>
Cc Andy Green <[email protected]>
net/wireless/sysfs.c +4 -2
Index: mac80211/net/wireless/sysfs.c
===================================================================
@@ -46,9 +46,10 @@ static ssize_t _store_add_iface(struct d
 	struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
 	int res;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->add_virtual_intf)
 		return -ENOSYS;
 
@@ -68,9 +69,10 @@ static ssize_t _store_remove_iface(struc
 	int res, ifidx;
 	struct net_device *netdev;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->del_virtual_intf)
 		return -ENOSYS;
 
Signature · 1 line
Greetings Michael.
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Michael Buesch

This adds a capability check to only allow creation and removal of interfaces by a network admin.

Should stable be getting this too, for people who use out-of-tree mac80211 drivers?

Quoted 31 lines
Cc Andy Green <[email protected]>

Index: mac80211/net/wireless/sysfs.c
===================================================================

net/wireless/sysfs.c +4 -2
@@ -46,9 +46,10 @@ static ssize_t _store_add_iface(struct d
 	struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
 	int res;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->add_virtual_intf)
 		return -ENOSYS;
 
@@ -68,9 +69,10 @@ static ssize_t _store_remove_iface(struc
 	int res, ifidx;
 	struct net_device *netdev;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->del_virtual_intf)
 		return -ENOSYS;