[PATCH 4/6] staging: rtl8188eu: use safe iterator in rtw_acl_remove_sta

Martin Kaiser
2021-05-16T16:07:50Z

Use list_for_each_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>
---
compile-tested only

drivers/staging/rtl8188eu/core/rtw_ap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
index a410b42ecb6e..601974df4114 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -1072,7 +1072,7 @@ 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 list_head *plist, *phead, *temp;
struct rtw_wlan_acl_node *paclnode;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
@@ -1083,7 +1083,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) {
+ list_for_each_safe(plist, temp, phead) {
paclnode = list_entry(plist, struct rtw_wlan_acl_node, list);

if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
--
2.20.1