aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-06 21:56:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:02:33 -0400
commit0b20633d966eb08506f8796544aef7a9ab5f3544 (patch)
treebf8a3ee2ae12c71c8e43601d35b04bbea3aaad92 /net/wireless
parent79c97e97aed7f760d2826c7daf2d42d8eefe9838 (diff)
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>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/core.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index b5e2f6dfa333..1a78b3c70cf2 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -331,8 +331,13 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
331 struct cfg80211_registered_device *rdev; 331 struct cfg80211_registered_device *rdev;
332 int alloc_size; 332 int alloc_size;
333 333
334 WARN_ON(!ops->add_key && ops->del_key); 334 WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
335 WARN_ON(ops->add_key && !ops->del_key); 335 WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
336 WARN_ON(ops->connect && !ops->disconnect);
337 WARN_ON(ops->join_ibss && !ops->leave_ibss);
338 WARN_ON(ops->add_virtual_intf && !ops->del_virtual_intf);
339 WARN_ON(ops->add_station && !ops->del_station);
340 WARN_ON(ops->add_mpath && !ops->del_mpath);
336 341
337 alloc_size = sizeof(*rdev) + sizeof_priv; 342 alloc_size = sizeof(*rdev) + sizeof_priv;
338 343
@@ -687,6 +692,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
687 mutex_destroy(&wdev->mtx); 692 mutex_destroy(&wdev->mtx);
688 break; 693 break;
689 case NETDEV_PRE_UP: 694 case NETDEV_PRE_UP:
695 if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
696 return notifier_from_errno(-EOPNOTSUPP);
690 if (rfkill_blocked(rdev->rfkill)) 697 if (rfkill_blocked(rdev->rfkill))
691 return notifier_from_errno(-ERFKILL); 698 return notifier_from_errno(-ERFKILL);
692 break; 699 break;