diff options
author | Ola Olsson <ola1olsson@gmail.com> | 2015-10-29 07:04:58 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-11-03 10:40:58 +0100 |
commit | 4baf6bea37247e59f1971e8009d13aeda95edba2 (patch) | |
tree | e64df44ad8496ec39bfd9461a932975c06ab7c51 /net/wireless | |
parent | 519ee6918b91abdc4bc9720deae17599a109eb40 (diff) | |
download | linux-4baf6bea37247e59f1971e8009d13aeda95edba2.tar.bz2 |
nl80211: Fix potential memory leak from parse_acl_data
If parse_acl_data succeeds but the subsequent parsing of smps
attributes fails, there will be a memory leak due to early returns.
Fix that by moving the ACL parsing later.
Cc: stable@vger.kernel.org
Fixes: 18998c381b19b ("cfg80211: allow requesting SMPS mode on ap start")
Signed-off-by: Ola Olsson <ola.olsson@sonymobile.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d693c9d031fc..40ef5d604eb4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3432,12 +3432,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) wdev->iftype)) return -EINVAL; - if (info->attrs[NL80211_ATTR_ACL_POLICY]) { - params.acl = parse_acl_data(&rdev->wiphy, info); - if (IS_ERR(params.acl)) - return PTR_ERR(params.acl); - } - if (info->attrs[NL80211_ATTR_SMPS_MODE]) { params.smps_mode = nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]); @@ -3461,6 +3455,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) params.smps_mode = NL80211_SMPS_OFF; } + if (info->attrs[NL80211_ATTR_ACL_POLICY]) { + params.acl = parse_acl_data(&rdev->wiphy, info); + if (IS_ERR(params.acl)) + return PTR_ERR(params.acl); + } + wdev_lock(wdev); err = rdev_start_ap(rdev, dev, ¶ms); if (!err) { |