From: Dan Carpenter Date: Mon, 7 Jun 2021 18:18:13 +0000 (+0300) Subject: staging: rtl8188eu: use safe iterator in xmit_delivery_enabled_frames() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=629132b3d523bef7b32657e17c0edc1cdaae7e0a;p=linux.git staging: rtl8188eu: use safe iterator in xmit_delivery_enabled_frames() This loop calls list_del_init(&pxmitframe->list) and "pxmitframe" is the list iterator so it leads to a forever loop. We need to use a _safe() iterator to fix this. Fixes: 23017c8842d2 ("staging: rtl8188eu: Use list iterators and helpers") Reviewed-by: Guenter Roeck Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YL5i5aVMQ3CZ5wuQ@mwanda Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index d5489811c5bc1..718dd20ff36cf 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1912,17 +1912,14 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta) { u8 wmmps_ac = 0; - struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct list_head *xmitframe_phead; + struct xmit_frame *pxmitframe, *n; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); xmitframe_phead = get_list_head(&psta->sleep_q); - list_for_each(xmitframe_plist, xmitframe_phead) { - pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, - list); - + list_for_each_entry_safe(pxmitframe, n, xmitframe_phead, list) { switch (pxmitframe->attrib.priority) { case 1: case 2: