UPSTREAM: nl80211: don't kfree() ERR_PTR() value

When parse_acl_data() fails, we get an ERR_PTR() value and
then "goto out;", in this case we'd attempt to kfree() it.
Fix that.

Fixes: 9e263e193af7 ("nl80211: don't put struct cfg80211_ap_settings on stack")
Link: https://lore.kernel.org/r/20210927134402.86c5ae06c952.Ic51e234d998b9045665e5ff8b6db7e29f25d70c0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit 05075fe7455a210769b266e62a0040ddc98b2739)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8df46fe71a5ffdad64e63de26a3c6276b9ee6314
This commit is contained in:
Johannes Berg 2021-09-27 13:44:03 +02:00 committed by Greg Kroah-Hartman
parent 0e2eb486c4
commit a8e96486c3
1 changed files with 1 additions and 0 deletions

View File

@ -5662,6 +5662,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
params->acl = parse_acl_data(&rdev->wiphy, info);
if (IS_ERR(params->acl)) {
err = PTR_ERR(params->acl);
params->acl = NULL;
goto out;
}
}