diff mbox series

[18/20] wifi: cfg80211: stop parsing after allocation failure

Message ID 20230618214436.0ffac98475cf.I6f5c08a09f5c9fced01497b95a9841ffd1b039f8@changeid
State New
Headers show
Series cfg80211/mac80211 patches from our internal tree 2023-06-18 | expand

Commit Message

Greenman, Gregory June 18, 2023, 6:50 p.m. UTC
From: Benjamin Berg <benjamin.berg@intel.com>

The error handling code would break out of the loop incorrectly,
causing the rest of the message to be misinterpreted. Fix this by
also jumping out of the surrounding while loop, which will trigger
the error detection code.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index cf0ad544cb99..b2cf7abd5ad0 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -707,7 +707,7 @@  static int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
 					GFP_ATOMIC);
 
 			if (!entry)
-				break;
+				goto error;
 
 			entry->center_freq = freq;
 
@@ -723,6 +723,7 @@  static int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
 		}
 	}
 
+error:
 	if (pos != end) {
 		cfg80211_free_coloc_ap_list(&ap_list);
 		return 0;