Message ID | 20241113095129.1457225-1-lizhi.xu@windriver.com |
---|---|
State | New |
Headers | show |
Series | [V2] mac802154: check local interfaces before deleting sdata list | expand |
Hello Lizhi Xu. On Wed, 13 Nov 2024 17:51:29 +0800, Lizhi Xu wrote: > syzkaller reported a corrupted list in ieee802154_if_remove. [1] > > Remove an IEEE 802.15.4 network interface after unregister an IEEE 802.15.4 > hardware device from the system. > > CPU0 CPU1 > ==== ==== > genl_family_rcv_msg_doit ieee802154_unregister_hw > ieee802154_del_iface ieee802154_remove_interfaces > rdev_del_virtual_intf_deprecated list_del(&sdata->list) > ieee802154_if_remove > list_del_rcu > > [...] Applied to wpan/wpan.git, thanks! [1/1] mac802154: check local interfaces before deleting sdata list https://git.kernel.org/wpan/wpan/c/eb09fbeb4870 regards, Stefan Schmidt
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index c0e2da5072be..9e4631fade90 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -684,6 +684,10 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata) ASSERT_RTNL(); mutex_lock(&sdata->local->iflist_mtx); + if (list_empty(&sdata->local->interfaces)) { + mutex_unlock(&sdata->local->iflist_mtx); + return; + } list_del_rcu(&sdata->list); mutex_unlock(&sdata->local->iflist_mtx);