Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: mac802154: fix WARNING in ieee802154_del_device
@ 2021-04-12 10:58 Pavel Skripkin
  2021-04-12 11:45 ` Alexander Aring
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Skripkin @ 2021-04-12 10:58 UTC (permalink / raw)
  To: alex.aring, stefan, davem
  Cc: linux-wpan, netdev, linux-kernel, Pavel Skripkin,
	syzbot+bf8b5834b7ec229487ce

syzbot reported WARNING in ieee802154_del_device. The problem
was in uninitialized mutex. In case of NL802154_IFTYPE_MONITOR
mutex won't be initialized, but ieee802154_del_device() accessing it.

Reported-by: syzbot+bf8b5834b7ec229487ce@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 net/mac802154/iface.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 1cf5ac09edcb..be8d2a02c882 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -599,6 +599,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
 
 		break;
 	case NL802154_IFTYPE_MONITOR:
+		mutex_init(&sdata->sec_mtx);
 		sdata->dev->needs_free_netdev = true;
 		sdata->dev->netdev_ops = &mac802154_monitor_ops;
 		wpan_dev->promiscuous_mode = true;
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: mac802154: fix WARNING in ieee802154_del_device
  2021-04-12 10:58 [PATCH] net: mac802154: fix WARNING in ieee802154_del_device Pavel Skripkin
@ 2021-04-12 11:45 ` Alexander Aring
  2021-04-12 16:41   ` Pavel Skripkin
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Aring @ 2021-04-12 11:45 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Stefan Schmidt, David S. Miller, linux-wpan - ML,
	open list:NETWORKING [GENERAL],
	kernel list, syzbot+bf8b5834b7ec229487ce

Hi,

On Mon, 12 Apr 2021 at 06:58, Pavel Skripkin <paskripkin@gmail.com> wrote:
>
> syzbot reported WARNING in ieee802154_del_device. The problem
> was in uninitialized mutex. In case of NL802154_IFTYPE_MONITOR
> mutex won't be initialized, but ieee802154_del_device() accessing it.
>
> Reported-by: syzbot+bf8b5834b7ec229487ce@syzkaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
>  net/mac802154/iface.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index 1cf5ac09edcb..be8d2a02c882 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -599,6 +599,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
>
>                 break;
>         case NL802154_IFTYPE_MONITOR:
> +               mutex_init(&sdata->sec_mtx);
>                 sdata->dev->needs_free_netdev = true;
>                 sdata->dev->netdev_ops = &mac802154_monitor_ops;
>                 wpan_dev->promiscuous_mode = true;

yes that will fix the issue, but will let the user notify that setting
any security setting is supported by monitors which is not the case.
There are patches around which should return -EOPNOTSUPP for monitors.
However we might support it in future to let the kernel encrypt air
frames, but this isn't supported yet and the user should be aware that
it isn't.

- Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: mac802154: fix WARNING in ieee802154_del_device
  2021-04-12 11:45 ` Alexander Aring
@ 2021-04-12 16:41   ` Pavel Skripkin
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Skripkin @ 2021-04-12 16:41 UTC (permalink / raw)
  To: Alexander Aring
  Cc: Stefan Schmidt, David S. Miller, linux-wpan - ML,
	open list:NETWORKING [GENERAL],
	kernel list, syzbot+bf8b5834b7ec229487ce

Hi!

On Mon, 2021-04-12 at 07:45 -0400, Alexander Aring wrote:
> Hi,
> 
> On Mon, 12 Apr 2021 at 06:58, Pavel Skripkin <paskripkin@gmail.com>
> wrote:
> > 
> > syzbot reported WARNING in ieee802154_del_device. The problem
> > was in uninitialized mutex. In case of NL802154_IFTYPE_MONITOR
> > mutex won't be initialized, but ieee802154_del_device() accessing
> > it.
> > 
> > Reported-by: syzbot+bf8b5834b7ec229487ce@syzkaller.appspotmail.com
> > Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> > ---
> >  net/mac802154/iface.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> > index 1cf5ac09edcb..be8d2a02c882 100644
> > --- a/net/mac802154/iface.c
> > +++ b/net/mac802154/iface.c
> > @@ -599,6 +599,7 @@ ieee802154_setup_sdata(struct
> > ieee802154_sub_if_data *sdata,
> > 
> >                 break;
> >         case NL802154_IFTYPE_MONITOR:
> > +               mutex_init(&sdata->sec_mtx);
> >                 sdata->dev->needs_free_netdev = true;
> >                 sdata->dev->netdev_ops = &mac802154_monitor_ops;
> >                 wpan_dev->promiscuous_mode = true;
> 
> yes that will fix the issue, but will let the user notify that
> setting
> any security setting is supported by monitors which is not the case.
> There are patches around which should return -EOPNOTSUPP for
> monitors.
> However we might support it in future to let the kernel encrypt air
> frames, but this isn't supported yet and the user should be aware
> that
> it isn't.
> 

Thank you for your feedback. I am still not familiar with net internals
yet :) Next time I ll try to go deeper. Thanks!

> - Alex

With regards,
Pavel Skripkin



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 10:58 [PATCH] net: mac802154: fix WARNING in ieee802154_del_device Pavel Skripkin
2021-04-12 11:45 ` Alexander Aring
2021-04-12 16:41   ` Pavel Skripkin

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git