diff mbox series

rtnetlink: Fix an error handling path in rtnl_newlink()

Message ID 881a292603df853c52c6197ea23cc44ed9141b86.1729952851.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series rtnetlink: Fix an error handling path in rtnl_newlink() | expand

Commit Message

Christophe JAILLET Oct. 26, 2024, 2:28 p.m. UTC
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".

So, go to "out" also in this case to free some resources before returning.

Fixes: 62262dd00c31 ("wifi: cfg80211: disallow SMPS in AP mode")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 net/wireless/nl80211.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1ac8a196f376..d9cc33474b85 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6273,8 +6273,10 @@  static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	if (info->attrs[NL80211_ATTR_SMPS_MODE] &&
-	    nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]) != NL80211_SMPS_OFF)
-		return -EOPNOTSUPP;
+	    nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]) != NL80211_SMPS_OFF) {
+		err = -EOPNOTSUPP;
+		goto out;
+	}
 
 	params->pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
 	if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {