Re: [PATCH 1/7] staging: rtl8188eu: use safe iterator in stop_ap_mode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 07, 2021 at 09:17:11PM +0300, Dan Carpenter wrote:
> This loop calls list_del_init() on the list iterator so it can result
> in a forever loop.
> 
> Fixes: 23017c8842d2 ("staging: rtl8188eu: Use list iterators and helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>

> ---
>  drivers/staging/rtl8188eu/core/rtw_ap.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
> index bbecb07274f6..9399c17bfdbf 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ap.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
> @@ -1688,8 +1688,7 @@ void start_ap_mode(struct adapter *padapter)
>  
>  void stop_ap_mode(struct adapter *padapter)
>  {
> -	struct list_head *phead, *plist;
> -	struct rtw_wlan_acl_node *paclnode;
> +	struct rtw_wlan_acl_node *paclnode, *n;
>  	struct sta_info *psta = NULL;
>  	struct sta_priv *pstapriv = &padapter->stapriv;
>  	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -1709,10 +1708,7 @@ void stop_ap_mode(struct adapter *padapter)
>  
>  	/* for ACL */
>  	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, n, &pacl_node_q->queue, list) {
>  		if (paclnode->valid) {
>  			paclnode->valid = false;
>  
> -- 
> 2.30.2
> 



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux