Commit 4baf6bea authored by Ola Olsson's avatar Ola Olsson Committed by Johannes Berg

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: 18998c38 ("cfg80211: allow requesting SMPS mode on ap start")
Signed-off-by: default avatarOla Olsson <ola.olsson@sonymobile.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 519ee691
...@@ -3432,12 +3432,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -3432,12 +3432,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
wdev->iftype)) wdev->iftype))
return -EINVAL; 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]) { if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
params.smps_mode = params.smps_mode =
nla_get_u8(info->attrs[NL80211_ATTR_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) ...@@ -3461,6 +3455,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
params.smps_mode = NL80211_SMPS_OFF; 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); wdev_lock(wdev);
err = rdev_start_ap(rdev, dev, &params); err = rdev_start_ap(rdev, dev, &params);
if (!err) { if (!err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment