Skip to content

Commit bb9df91

Browse files
tititiou36jmberg-intel
authored andcommitted
wifi: cfg80211: Fix an error handling path in nl80211_start_ap()
All error handling paths go to "out", except this one. Before the commit in Fixes, error in the previous code would also end to "out", freeing the memory. Move the code up to avoid the leak. Fixes: 62262dd ("wifi: cfg80211: disallow SMPS in AP mode") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/eae54ce066d541914f272b10cab7b263c08eced3.1729956868.git.christophe.jaillet@wanadoo.fr [move code, update commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 9c46a3a commit bb9df91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/wireless/nl80211.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6123,6 +6123,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
61236123
!info->attrs[NL80211_ATTR_BEACON_HEAD])
61246124
return -EINVAL;
61256125

6126+
if (info->attrs[NL80211_ATTR_SMPS_MODE] &&
6127+
nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]) != NL80211_SMPS_OFF)
6128+
return -EOPNOTSUPP;
6129+
61266130
params = kzalloc(sizeof(*params), GFP_KERNEL);
61276131
if (!params)
61286132
return -ENOMEM;
@@ -6272,10 +6276,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
62726276
goto out;
62736277
}
62746278

6275-
if (info->attrs[NL80211_ATTR_SMPS_MODE] &&
6276-
nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]) != NL80211_SMPS_OFF)
6277-
return -EOPNOTSUPP;
6278-
62796279
params->pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
62806280
if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
62816281
err = -EOPNOTSUPP;

0 commit comments

Comments
 (0)