From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 9/9] cfg80211: disallow configuring unsupported interfaces
Date: Tue, 07 Jul 2009 03:56:13 +0200 [thread overview]
Message-ID: <20090707015709.554947659@sipsolutions.net> (raw)
In-Reply-To: 20090707015604.369008211@sipsolutions.net
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>
---
net/wireless/core.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- wireless-testing.orig/net/wireless/core.c 2009-07-07 03:37:06.000000000 +0200
+++ wireless-testing/net/wireless/core.c 2009-07-07 03:37:07.000000000 +0200
@@ -331,8 +331,13 @@ struct wiphy *wiphy_new(const struct cfg
struct cfg80211_registered_device *rdev;
int alloc_size;
- WARN_ON(!ops->add_key && ops->del_key);
- WARN_ON(ops->add_key && !ops->del_key);
+ WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_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;
@@ -687,6 +692,8 @@ static int cfg80211_netdev_notifier_call
mutex_destroy(&wdev->mtx);
break;
case NETDEV_PRE_UP:
+ if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
+ return notifier_from_errno(-EOPNOTSUPP);
if (rfkill_blocked(rdev->rfkill))
return notifier_from_errno(-ERFKILL);
break;
--
prev parent reply other threads:[~2009-07-07 2:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-07 1:56 [PATCH 0/9] cfg80211 fixes, cleanups, improvements Johannes Berg
2009-07-07 1:56 ` [PATCH 1/9] cfg80211: fix netdev down problem Johannes Berg
2009-07-07 1:56 ` [PATCH 2/9] cfg80211: dont use union for wext Johannes Berg
2009-07-07 1:56 ` [PATCH 3/9] cfg80211: mlme API must be able to sleep Johannes Berg
2009-07-07 1:56 ` [PATCH 4/9] cfg80211: warn again on spurious deauth Johannes Berg
2009-07-07 1:56 ` [PATCH 5/9] cfg80211: properly name driver locking Johannes Berg
2009-07-07 1:56 ` [PATCH 6/9] cfg80211: fix MFP bug, sparse warnings Johannes Berg
2009-07-07 1:56 ` [PATCH 7/9] cfg80211: fix locking Johannes Berg
2009-07-07 1:56 ` [PATCH 8/9] cfg80211: clean up naming once and for all Johannes Berg
2009-07-07 1:56 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090707015709.554947659@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).