staging: rtl8188eu: use safe iterator in dequeue_xmitframes_to_sleeping_queue()

On some code paths the xmitframe_enqueue_for_sleeping_sta() function can
call list_del_init(&pxmitframe->list) which would lead to a forever loop
because "pxmitframe" is the list iterator.  Use the _safe version of the
iterator to prevent this.

Fixes: 23017c8842 ("staging: rtl8188eu: Use list iterators and helpers")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YL5ixzKaYKkpHhky@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter
2021-06-07 21:17:43 +03:00
committed by Greg Kroah-Hartman
parent b5e944c50c
commit e0f489a25a

View File

@@ -1729,17 +1729,15 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra
static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struct sta_info *psta, struct __queue *pframequeue)
{
struct list_head *plist, *phead;
struct list_head *phead;
u8 ac_index;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib;
struct xmit_frame *pxmitframe;
struct xmit_frame *pxmitframe, *n;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
list_for_each(plist, phead) {
pxmitframe = list_entry(plist, struct xmit_frame, list);
list_for_each_entry_safe(pxmitframe, n, phead, list) {
xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe);
pattrib = &pxmitframe->attrib;