mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
staging: rtl8188eu: use safe iterator in rtw_sta_flush
Use list_for_each_entry_safe, we may delete list items while iterating
over the list.
Fixes: 23017c8842 ("staging: rtl8188eu: Use list iterators and helpers")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210517201826.25150-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b0f2044c61
commit
2253748164
@@ -1573,8 +1573,8 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
|
||||
|
||||
int rtw_sta_flush(struct adapter *padapter)
|
||||
{
|
||||
struct list_head *phead, *plist;
|
||||
struct sta_info *psta = NULL;
|
||||
struct list_head *phead;
|
||||
struct sta_info *psta, *temp;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
@@ -1588,9 +1588,7 @@ int rtw_sta_flush(struct adapter *padapter)
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
phead = &pstapriv->asoc_list;
|
||||
/* free sta asoc_queue */
|
||||
list_for_each(plist, phead) {
|
||||
psta = list_entry(plist, struct sta_info, asoc_list);
|
||||
|
||||
list_for_each_entry_safe(psta, temp, phead, asoc_list) {
|
||||
list_del_init(&psta->asoc_list);
|
||||
pstapriv->asoc_list_cnt--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user