Skip to contentSkip to conversation

net:mac802154: add init of .sec and .sec_mtx for sdata in ieee802154_setup_sdata

PATCH In review Du Cheng 2 participants 3 messages Apr 4, 2021 – Apr 5, 2021

Subsystems (2)
lore
Share & tools
lore

Du Cheng

author
#0 lore raw

PATCH 1/1 net:mac802154: add init of .sec and .sec_mtx for sdata in ieee802154_setup_sdata

add mutex_init(&sdata->sec_mtx) and mac802154_llsec_init(&sdata->sec) for NL802154_IFTYPE_MONITOR inside ieee802154_setup_sdata. As the unintiated mutex and sec data structure were used in ieee802154_get_llsec_params which would cause a kernel crash. BUG reported by syzkaller.

---
link to syzkaller bug:
https://syzkaller.appspot.com/bug?id=a9cc0c65e7bb15be7143107d4215ebc8ef047528
This patch has passed syzbot testing.

 net/mac802154/iface.c | 3 +++
 1 file changed, 3 insertions(+)
net/mac802154/iface.c +3 -0
index 1cf5ac09edcb..bec903e98db0 100644
@@ -602,6 +602,9 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
 		sdata->dev->needs_free_netdev = true;
 		sdata->dev->netdev_ops = &mac802154_monitor_ops;
 		wpan_dev->promiscuous_mode = true;
+
+		mutex_init(&sdata->sec_mtx);
+		mac802154_llsec_init(&sdata->sec);
 		break;
 	default:
 		BUG();
Signature · 1 line
2.30.2
maintainer
#1 lore raw

Hi,

Quoted 5 lines · Du Cheng

add mutex_init(&sdata->sec_mtx) and mac802154_llsec_init(&sdata->sec) for NL802154_IFTYPE_MONITOR inside ieee802154_setup_sdata. As the unintiated mutex and sec data structure were used in ieee802154_get_llsec_params which would cause a kernel crash. BUG reported by syzkaller.

this patch will fix it in a way that the user is allowed to set llsec parameters for monitors but they will never use them because it's not supported. I resend my patch series which should forbid monitors to set any llsec parameters for now and the user will be aware that this feature isn't supported right now.

Thanks.

- Alex

author
#2 lore raw
Quoted 15 lines · Alexander Aring

Hi,

Quoted 5 lines · Du Cheng

add mutex_init(&sdata->sec_mtx) and mac802154_llsec_init(&sdata->sec) for NL802154_IFTYPE_MONITOR inside ieee802154_setup_sdata. As the unintiated mutex and sec data structure were used in ieee802154_get_llsec_params which would cause a kernel crash. BUG reported by syzkaller.

this patch will fix it in a way that the user is allowed to set llsec parameters for monitors but they will never use them because it's not supported. I resend my patch series which should forbid monitors to set any llsec parameters for now and the user will be aware that this feature isn't supported right now.

Quoted 3 lines

Thanks.

- Alex

Hi Alex,

Noted. Please CC me when you send your patch series. Thanks!

Regards,
Du Cheng