Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Du Cheng <ducheng2@gmail.com>
To: Alexander Aring <alex.aring@gmail.com>,
	Stefan Schmidt <stefan@datenfreihafen.org>
Cc: linux-wpan@vger.kernel.org, gregkh@linuxfoundation.org,
	skhan@linuxfoundation.org, Du Cheng <ducheng2@gmail.com>,
	syzbot+cde43a581a8e5f317bc2@syzkaller.appspotmail.com
Subject: [PATCH] net:mac802154: add init of .sec and .sec_mtx for sdata in ieee802154_setup_sdata
Date: Sun,  4 Apr 2021 12:57:12 +0800	[thread overview]
Message-ID: <20210404045712.50954-1-ducheng2@gmail.com> (raw)

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.

Reported-by: syzbot+cde43a581a8e5f317bc2@syzkaller.appspotmail.com
Signed-off-by: Du Cheng <ducheng2@gmail.com>
---
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(+)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 1cf5ac09edcb..bec903e98db0 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -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();
-- 
2.30.2


             reply	other threads:[~2021-04-04  4:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04  4:57 Du Cheng [this message]
2021-04-05  0:33 ` [PATCH] net:mac802154: add init of .sec and .sec_mtx for sdata in ieee802154_setup_sdata Alexander Aring
2021-04-05  3:50   ` Du Cheng

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=20210404045712.50954-1-ducheng2@gmail.com \
    --to=ducheng2@gmail.com \
    --cc=alex.aring@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stefan@datenfreihafen.org \
    --cc=syzbot+cde43a581a8e5f317bc2@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