diff mbox series

staging: r8188eu: Prevent infinite loop

Message ID 20220814174404.25923-1-Larry.Finger@lwfinger.net
State New
Headers show
Series staging: r8188eu: Prevent infinite loop | expand

Commit Message

Larry Finger Aug. 14, 2022, 5:44 p.m. UTC
---
 drivers/staging/r8188eu/core/rtw_ieee80211.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c
index bc8543ea2e66..0a5f08427385 100644
--- a/drivers/staging/r8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c
@@ -531,6 +531,7 @@  u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
 	uint cnt;
 	u8 *wpsie_ptr = NULL;
 	u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
+	int loop_max = 0;
 
 	if (wps_ielen)
 		*wps_ielen = 0;
@@ -557,6 +558,8 @@  u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
 			break;
 		}
 		cnt += in_ie[cnt + 1] + 2; /* goto next */
+		if (++loop > 1000)
+			return NULL;
 	}
 	return wpsie_ptr;
 }