diff options
author | Martin Kaiser <martin@kaiser.cx> | 2021-05-17 22:18:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-19 17:54:51 +0200 |
commit | b0f2044c61d9ef309252d25d16d6cce6e8fcae6b (patch) | |
tree | 56959da7799d567c1b33c09340be2f01a7f70d2d | |
parent | 39b19c63a39a2de6516383774a529287f04a243e (diff) | |
download | linux-b0f2044c61d9ef309252d25d16d6cce6e8fcae6b.tar.gz linux-b0f2044c61d9ef309252d25d16d6cce6e8fcae6b.tar.bz2 linux-b0f2044c61d9ef309252d25d16d6cce6e8fcae6b.zip |
staging: rtl8188eu: use safe iterator in rtw_acl_remove_sta
Use list_for_each_entry_safe, we may delete list items while iterating
over the list.
Fixes: 23017c8842d2 ("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-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_ap.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 6d7c96f1aa42..d297d5301153 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1068,8 +1068,8 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) { - struct list_head *plist, *phead; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *temp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1079,9 +1079,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); - list_for_each(plist, phead) { - paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); - + list_for_each_entry_safe(paclnode, temp, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; |