From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Alexander Aring <alex.aring@gmail.com>,
Stefan Schmidt <stefan@datenfreihafen.org>,
linux-wpan@vger.kernel.org, netdev@vger.kernel.org,
lvc-project@linuxtesting.org,
syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.com
Subject: Re: [PATCH] mac802154: fix interface deletion
Date: Mon, 11 Nov 2024 20:41:48 +0100 [thread overview]
Message-ID: <87v7wtpngj.fsf@bootlin.com> (raw)
In-Reply-To: <20241108124051.415090-1-dmantipov@yandex.ru> (Dmitry Antipov's message of "Fri, 8 Nov 2024 15:40:51 +0300")
Hello Dmitry,
> --- 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);
Why not just enclose this list_del() within a mutex_lock(iflist_mtx)
like the others? Would probably make more sense and prevent the use of
yet another protection mechanism? Is there anything preventing the use
of this mutex here?
Thanks,
Miquèl
next prev parent reply other threads:[~2024-11-11 19:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 12:40 [PATCH] mac802154: fix interface deletion Dmitry Antipov
2024-11-11 19:41 ` Miquel Raynal [this message]
2024-11-12 5:47 ` Dmitry Antipov
2024-11-12 9:11 ` Dmitry Antipov
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=87v7wtpngj.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=alex.aring@gmail.com \
--cc=dmantipov@yandex.ru \
--cc=linux-wpan@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=stefan@datenfreihafen.org \
--cc=syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).