ieee802154: hwsim: fix edge allocation leak and netlink attribute validation
Subsystems (3)
PATCH 1/1 ieee802154: hwsim: fix edge allocation leak and netlink attribute validation
In drivers/net/ieee802154/mac802154_hwsim.c, clean up allocated edges and phys on error paths and validate netlink attribute bounds.
---
drivers/net/ieee802154/mac802154_hwsim.c +4 -1
@@ -987,6 +987,8 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev, err_subscribe:ieee802154_unregister_hw (phy->hw); +kfree_rcu (rcu_dereference_protected (phy->pib,1 ), rcu); + goto err_pib; err_reg:kfree (pib); err_pib:
@@ -1003,6 +1005,8 @@ static void hwsim_del(struct hwsim_phy *phy)list_del (&phy->list); +ieee802154_unregister_hw (phy->hw); +rcu_read_lock ();list_for_each_entry_rcu (e, &phy->edges, list) {list_del_rcu (&e->list);
@@ -1013,7 +1017,6 @@ static void hwsim_del(struct hwsim_phy *phy)kfree_rcu (pib, rcu); -ieee802154_unregister_hw (phy->hw);ieee802154_free_hw (phy->hw); }
Quoted 6 lines · Hui Peng
In
drivers/net/ieee802154/mac802154_hwsim.c, clean up allocated edges and phys on error paths and validate netlink attribute bounds.Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")Assisted-by LLMSigned-off-by Hui Peng <[email protected]>
Miquel Raynal
maintainerQuoted 10 lines · Miquel Raynal
Quoted 6 lines · Hui Peng
In
drivers/net/ieee802154/mac802154_hwsim.c, clean up allocated edges and phys on error paths and validate netlink attribute bounds.Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")Assisted-by LLMSigned-off-by Hui Peng <[email protected]>Reviewed-by Miquel Raynal <[email protected]>
The commit message is incoherent, I would like to withdraw my tag.
Also, this is the fourth time we receive a similar fix. I already reviewed this one:
https://lore.kernel.org/all/[email protected]/
For which I wait for a v2 which never comes. You can take the feedback sent there into account (still applies).
Thanks,
Miquèl