From: syzbot <syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Re: BUG: corrupted list in ieee802154_if_remove
Date: Fri, 08 Nov 2024 04:43:53 -0800 [thread overview]
Message-ID: <672e0789.050a0220.69fce.0014.GAE@google.com> (raw)
In-Reply-To: <672b9f03.050a0220.350062.0276.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: BUG: corrupted list in ieee802154_if_remove
Author: dmantipov@yandex.ru
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 906bd684e4b1e517dd424a354744c5b0aebef8af
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 08dd521a51a5..7afcea3447c1 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -40,9 +40,8 @@ struct ieee802154_local {
int open_count;
/* As in mac80211 slaves list is modified:
- * 1) under the RTNL
- * 2) protected by slaves_mtx;
- * 3) in an RCU manner
+ * 1) under the RTNL;
+ * 2) protected by iflist_mtx.
*
* So atomic readers can use any of this protection methods.
*/
@@ -101,6 +100,7 @@ enum {
enum ieee802154_sdata_state_bits {
SDATA_STATE_RUNNING,
+ SDATA_STATE_REMOVED,
};
/* Slave interface definition.
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index c0e2da5072be..700c80e94bb2 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -669,7 +669,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
goto err;
mutex_lock(&local->iflist_mtx);
- list_add_tail_rcu(&sdata->list, &local->interfaces);
+ list_add_tail(&sdata->list, &local->interfaces);
mutex_unlock(&local->iflist_mtx);
return ndev;
@@ -683,11 +683,13 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
{
ASSERT_RTNL();
+ if (test_and_set_bit(SDATA_STATE_REMOVED, &sdata->state))
+ return;
+
mutex_lock(&sdata->local->iflist_mtx);
- list_del_rcu(&sdata->list);
+ list_del(&sdata->list);
mutex_unlock(&sdata->local->iflist_mtx);
- synchronize_rcu();
unregister_netdevice(sdata->dev);
}
@@ -697,6 +699,8 @@ void ieee802154_remove_interfaces(struct ieee802154_local *local)
mutex_lock(&local->iflist_mtx);
list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
+ if (test_and_set_bit(SDATA_STATE_REMOVED, &sdata->state))
+ continue;
list_del(&sdata->list);
unregister_netdevice(sdata->dev);
--
2.47.0
next prev parent reply other threads:[~2024-11-08 12:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 16:53 [syzbot] [wpan?] [usb?] BUG: corrupted list in ieee802154_if_remove syzbot
2024-11-08 7:17 ` [syzbot] " syzbot
2024-11-08 7:18 ` syzbot
2024-11-08 9:31 ` syzbot
2024-11-08 11:24 ` syzbot
2024-11-08 12:43 ` syzbot [this message]
2024-11-08 14:54 ` [PATCH] mac802154: add a check for slave data list before delete Lizhi Xu
2024-11-11 19:46 ` Miquel Raynal
2024-11-12 0:21 ` Lizhi Xu
2024-11-12 4:31 ` [syzbot] [wpan?] [usb?] BUG: corrupted list in ieee802154_if_remove syzbot
2024-11-12 11:01 ` [PATCH] mac802154: add a check for slave data list before delete Miquel Raynal
2024-11-12 13:41 ` Lizhi Xu
2024-11-13 8:26 ` Miquel Raynal
2024-11-13 9:51 ` [PATCH V2] mac802154: check local interfaces before deleting sdata list Lizhi Xu
2024-11-19 10:06 ` Stefan Schmidt
2024-11-13 10:29 ` [PATCH] mac802154: add a check for slave data list before delete Dmitry Antipov
2024-11-13 10:58 ` Miquel Raynal
2024-11-13 12:45 ` Dmitry Antipov
2024-11-14 1:00 ` Lizhi Xu
2024-11-14 1:17 ` Lizhi Xu
2024-11-08 16:29 ` [syzbot] Re: BUG: corrupted list in ieee802154_if_remove syzbot
2024-11-09 2:51 ` [syzbot] Re: BUG: corrupted list in ieee802154_if_remove() syzbot
2024-11-12 6:46 ` syzbot
2024-11-12 12:35 ` [syzbot] Re: [syzbot] [wpan?] [usb?] BUG: corrupted list in ieee802154_if_remove syzbot
2024-11-12 13:11 ` syzbot
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=672e0789.050a0220.69fce.0014.GAE@google.com \
--to=syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.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.