Commit af39f935 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

staging: rtl8188eu: use safe iterator in rtw_free_xmitframe_queue



Use list_for_each_entry_safe, we may delete list items while iterating
over the list.

Fixes: 23017c88 ("staging: rtl8188eu: Use list iterators and helpers")
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210517201826.25150-6-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 22537481
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -1329,17 +1329,15 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram


void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pframequeue)
void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pframequeue)
{
{
	struct list_head *plist, *phead;
	struct list_head *phead;
	struct	xmit_frame	*pxmitframe;
	struct	xmit_frame	*pxmitframe, *temp;


	spin_lock_bh(&pframequeue->lock);
	spin_lock_bh(&pframequeue->lock);


	phead = get_list_head(pframequeue);
	phead = get_list_head(pframequeue);
	list_for_each(plist, phead) {
	list_for_each_entry_safe(pxmitframe, temp, phead, list)
		pxmitframe = list_entry(plist, struct xmit_frame, list);

		rtw_free_xmitframe(pxmitpriv, pxmitframe);
		rtw_free_xmitframe(pxmitpriv, pxmitframe);
	}

	spin_unlock_bh(&pframequeue->lock);
	spin_unlock_bh(&pframequeue->lock);
}
}