All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Larry Finger <Larry.Finger@lwfinger.net>,
	Guenter Roeck <linux@roeck-us.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Martin Kaiser <martin@kaiser.cx>,
	Ivan Safonov <insafonov@gmail.com>,
	Paul McQuade <paulmcquad@gmail.com>,
	Michael Straube <straube.linux@gmail.com>,
	linux-staging@lists.linux.dev, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/7] staging: rtl8188eu: use safe iterator in stop_ap_mode()
Date: Mon, 7 Jun 2021 21:17:11 +0300	[thread overview]
Message-ID: <YL5ip4yz9NEB9RZO@mwanda> (raw)
In-Reply-To: <YL5iX3Exc0HVYrsi@mwanda>

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@oracle.com>
---
 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


  reply	other threads:[~2021-06-07 18:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 18:15 [PATCH 0/7] staging: rtl8188eu: use safe version of list iterators Dan Carpenter
2021-06-07 18:17 ` Dan Carpenter [this message]
2021-06-09 10:33   ` [PATCH 1/7] staging: rtl8188eu: use safe iterator in stop_ap_mode() Guenter Roeck
2021-06-07 18:17 ` [PATCH 2/7] staging: rtl8188eu: use safe iterator in tx_beacon_hdl() Dan Carpenter
2021-06-09 10:34   ` Guenter Roeck
2021-06-07 18:17 ` [PATCH 3/7] staging: rtl8188eu: use safe iterator in dequeue_xmitframes_to_sleeping_queue() Dan Carpenter
2021-06-09 10:35   ` Guenter Roeck
2021-06-07 18:17 ` [PATCH 4/7] staging: rtl8188eu: use safe iterator in wakeup_sta_to_xmit() Dan Carpenter
2021-06-09 10:36   ` Guenter Roeck
2021-06-07 18:18 ` [PATCH 5/7] staging: rtl8188eu: use safe iterator in xmit_delivery_enabled_frames() Dan Carpenter
2021-06-09 10:37   ` Guenter Roeck
2021-06-07 18:18 ` [PATCH 6/7] staging: rtl8188eu: use safe iterator in rtl8188eu_xmitframe_complete() Dan Carpenter
2021-06-09 10:37   ` Guenter Roeck
2021-06-07 18:19 ` [PATCH 7/7] staging: rtl8188eu: delete some dead code Dan Carpenter
2021-06-09 10:39   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YL5ip4yz9NEB9RZO@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=insafonov@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux@roeck-us.net \
    --cc=martin@kaiser.cx \
    --cc=paulmcquad@gmail.com \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.