cfg80211: disallow configuring unsupported interfaces
In order to force drivers to advertise their interface types, don't just disallow creating new interfaces with unadvertised types but also disallow setting them UP. Additionally, add some validation on the operations the drivers support. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
79c97e97ae
commit
0b20633d96
|
@ -331,8 +331,13 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
|
||||||
struct cfg80211_registered_device *rdev;
|
struct cfg80211_registered_device *rdev;
|
||||||
int alloc_size;
|
int alloc_size;
|
||||||
|
|
||||||
WARN_ON(!ops->add_key && ops->del_key);
|
WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
|
||||||
WARN_ON(ops->add_key && !ops->del_key);
|
WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
|
||||||
|
WARN_ON(ops->connect && !ops->disconnect);
|
||||||
|
WARN_ON(ops->join_ibss && !ops->leave_ibss);
|
||||||
|
WARN_ON(ops->add_virtual_intf && !ops->del_virtual_intf);
|
||||||
|
WARN_ON(ops->add_station && !ops->del_station);
|
||||||
|
WARN_ON(ops->add_mpath && !ops->del_mpath);
|
||||||
|
|
||||||
alloc_size = sizeof(*rdev) + sizeof_priv;
|
alloc_size = sizeof(*rdev) + sizeof_priv;
|
||||||
|
|
||||||
|
@ -687,6 +692,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
|
||||||
mutex_destroy(&wdev->mtx);
|
mutex_destroy(&wdev->mtx);
|
||||||
break;
|
break;
|
||||||
case NETDEV_PRE_UP:
|
case NETDEV_PRE_UP:
|
||||||
|
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
|
||||||
|
return notifier_from_errno(-EOPNOTSUPP);
|
||||||
if (rfkill_blocked(rdev->rfkill))
|
if (rfkill_blocked(rdev->rfkill))
|
||||||
return notifier_from_errno(-ERFKILL);
|
return notifier_from_errno(-ERFKILL);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue