netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: cfg80211: Replace a label in cfg80211_parse_ml_sta_data()
@ 2023-12-31 10:33 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2023-12-31 10:33 UTC (permalink / raw)
  To: linux-wireless, netdev, kernel-janitors, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Johannes Berg, Paolo Abeni
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 31 Dec 2023 11:22:42 +0100

The kfree() function was called in one case by
the cfg80211_parse_ml_sta_data() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus use an other label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/wireless/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index cf2131671eb6..492e30138418 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2693,7 +2693,7 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy,

 	new_ie = kmalloc(IEEE80211_MAX_DATA_LEN, gfp);
 	if (!new_ie)
-		goto out;
+		goto free_mle;

 	for (i = 0; i < ARRAY_SIZE(mle->sta_prof) && mle->sta_prof[i]; i++) {
 		const struct ieee80211_neighbor_ap_info *ap_info;
@@ -2812,8 +2812,8 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy,
 		cfg80211_put_bss(wiphy, bss);
 	}

-out:
 	kfree(new_ie);
+free_mle:
 	kfree(mle);
 }

--
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-31 10:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-31 10:33 [PATCH] wifi: cfg80211: Replace a label in cfg80211_parse_ml_sta_data() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).