cfg80211: Don't allow users to create/remove interfaces
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.
Signed-off-by Michael Buesch <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Andy Green <[email protected]>
net/wireless/sysfs.c +4 -2
@@ -46,9 +46,10 @@ static ssize_t _store_add_iface(struct dstruct 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(strucint 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.
Quoted 5 lines · Michael Buesch
This adds a capability check to only allow creation and removal of interfaces by a network admin.
Signed-off-by Michael Buesch <[email protected]>Cc Johannes Berg <[email protected]>
Acked-by Johannes Berg <[email protected]>
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 dstruct 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(strucint 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 ;