ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
Subsystems (3)
PATCH 1/1 ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE must be present to fix GPF.
--- drivers/net/ieee802154/mac802154_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/mac802154_hwsim.c +1 -1
@@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info)struct hwsim_edge *e;u32 v0, v1; -if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] && +if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] || !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE ])return -EINVAL ;
Signature · 1 line
2.25.1
Quoted 3 lines · Dongliang Mu
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.
I double-check the whole file, and there is only one similar issue left in Line 421.
mac802154_hwsim.c 187 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
mac802154_hwsim.c 299 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
mac802154_hwsim.c 421 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] &&
mac802154_hwsim.c 483 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||
mac802154_hwsim.c 531 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||
mac80211_hwsim.c 3575 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] ||
mac80211_hwsim.c 3663 if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] ||
mac80211_hwsim.c 3982 if (!info->attrs[HWSIM_ATTR_RADIO_ID])
In addition, I check this pattern in the whole source code, it seems if statements with "&&" in other files are correct. For example,
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
(!info->attrs[NFC_ATTR_LLC_PARAM_LTO] &&
!info->attrs[NFC_ATTR_LLC_PARAM_RW] &&
!info->attrs[NFC_ATTR_LLC_PARAM_MIUX]))
return -EINVAL;Quoted 23 lines
Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")Signed-off-by Dongliang Mu <[email protected]>--- drivers/net/ieee802154/mac802154_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ieee802154/mac802154_hwsim.c +1
-2@@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info)struct hwsim_edge *e;u32 v0, v1; -if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] && +if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] || !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE ])return -EINVAL ; --2.25.1
Alexander Aring
maintainerHi,
Quoted 9 lines · Dongliang Mu
Quoted 3 lines · Dongliang Mu
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.I double-check the whole file, and there is only one similar issue left in Line 421.
What about "hwsim_del_edge_nl()" line 483, I think it has the same issue?
- Alex
Quoted 7 lines · Alexander Aring
Hi,
Quoted 3 lines · Dongliang Mu
Quoted 1 line · Dongliang Mu
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.I double-check the whole file, and there is only one similar issue left in Line 421.
What about "
hwsim_del_edge_nl()" line 483, I think it has the same issue?
Eric already submitted a patch [1] to fix this function and the patch is already merged in the mainline.
Quoted 2 lines
- Alex
Alexander Aring
maintainerHi,
Quoted 16 lines · Dongliang Mu
Quoted 14 lines · Alexander Aring
Hi,
Quoted 9 lines · Dongliang Mu
Quoted 3 lines · Dongliang Mu
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.I double-check the whole file, and there is only one similar issue left in Line 421.
Quoted 6 lines
Quoted 1 line
What about "
hwsim_del_edge_nl()" line 483, I think it has the same issue?Eric already submitted a patch [1] to fix this function and the patch is already merged in the mainline.
ah, yes. Thanks.
- Alex
Hi,
Quoted 6 lines · Dongliang Mu
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")Signed-off-by Dongliang Mu <[email protected]>
- Alex
Stefan Schmidt
maintainerHello.
Quoted 11 lines · Alexander Aring
Hi,
Quoted 6 lines · Dongliang Mu
Both
MAC802154_HWSIM_ATTR_RADIO_IDandMAC802154_HWSIM_ATTR_RADIO_EDGEmust be present to fix GPF.Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")Signed-off-by Dongliang Mu <[email protected]>Acked-by Alexander Aring <[email protected]>
This patch has been applied to the wpan tree and will be part of the next pull request to net. Thanks!
regards
Stefan Schmidt