nl80211: fix per-station group key get/del and memory leak
authorJohannes Berg <johannes.berg@intel.com>
Fri, 23 Jan 2015 10:10:12 +0000 (11:10 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:39 +0000 (00:49 +0000)
commiteadde1b43207903133a887583c496b94446683b5
tree75ed7cac85fe4d43805a06628a0c7ffd7f90e195
parent3175b4cb1aa4b1430fada4679be4598f6eb8872b
nl80211: fix per-station group key get/del and memory leak

commit 0fa7b39131576dd1baa6ca17fca53c65d7f62249 upstream.

In case userspace attempts to obtain key information for or delete a
unicast key, this is currently erroneously rejected unless the driver
sets the WIPHY_FLAG_IBSS_RSN flag. Apparently enough drivers do so it
was never noticed.

Fix that, and while at it fix a potential memory leak: the error path
in the get_key() function was placed after allocating a message but
didn't free it - move it to a better place. Luckily admin permissions
are needed to call this operation.

Fixes: e31b82136d1ad ("cfg80211/mac80211: allow per-station GTKs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/wireless/nl80211.c