summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg2013-10-29 10:00:08 +0100
committerJohannes Berg2013-11-25 20:50:44 +0100
commit5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167 (patch)
tree4bee7ff8563d66c62e4eb34e44bc230d5f1f1c17 /net
parentcfg80211: don't allow drivers to unset NL80211_FEATURE_SCAN_FLUSH (diff)
downloadkernel-qcow2-linux-5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167.tar.gz
kernel-qcow2-linux-5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167.tar.xz
kernel-qcow2-linux-5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167.zip
mac80211: verify ieee80211_key_replace() arguments
There's no code calling ieee80211_key_replace() with both arguments NULL and it wouldn't make sense, but in the interest of maintainability add a warning for it. As a side effect, this also shuts up a smatch warning. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/key.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 3e51dd7d98b3..ab8468047200 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -260,6 +260,10 @@ static void ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
int idx;
bool defunikey, defmultikey, defmgmtkey;
+ /* caller must provide at least one old/new */
+ if (WARN_ON(!new && !old))
+ return;
+
if (new)
list_add_tail(&new->list, &sdata->key_list);