From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:11
Hi,
this patch series contains fixes found by syzbot for nl802154 and a
memory leak each time we receiving a skb for monitor interfaces.
The first three patches are misc fixes, all others are to forbid monitor
interfaces to access security mib values which are never initialized for
monitor interfaces yet. We never supported such handling but I can
imagine that we can use security mib for monitor interfaces to decrypt
802.15.4 frames by the Linux kernel and the RAW sockets can see
plaintext then. However it's a possibility for an new feature to check in
due courses.
- Alex
Alexander Aring (17):
net: ieee802154: make shift exponent unsigned
net: ieee802154: fix memory leak when deliver monitor skbs
net: ieee802154: nl-mac: fix check on panid
net: ieee802154: forbid monitor for set llsec params
net: ieee802154: stop dump llsec keys for monitors
net: ieee802154: forbid monitor for add llsec key
net: ieee802154: forbid monitor for del llsec key
net: ieee802154: stop dump llsec devs for monitors
net: ieee802154: forbid monitor for add llsec dev
net: ieee802154: forbid monitor for del llsec dev
net: ieee802154: stop dump llsec devkeys for monitors
net: ieee802154: forbid monitor for add llsec devkey
net: ieee802154: forbid monitor for del llsec devkey
net: ieee802154: stop dump llsec seclevels for monitors
net: ieee802154: forbid monitor for add llsec seclevel
net: ieee802154: forbid monitor for del llsec seclevel
net: ieee802154: stop dump llsec params for monitors
net/ieee802154/nl-mac.c | 7 ++---
net/ieee802154/nl802154.c | 54 ++++++++++++++++++++++++++++++++++++++-
net/mac802154/rx.c | 2 ++
3 files changed, 59 insertions(+), 4 deletions(-)
--
2.26.2
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:11
This patch changes the iftype type variable to unsigned that it can
never be reach a negative value.
Reported-by: syzbot+7bf7b22759195c9a21e9@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -898,8 +898,8 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info)staticintnl802154_new_interface(structsk_buff*skb,structgenl_info*info){structcfg802154_registered_device*rdev=info->user_ptr[0];-enumnl802154_iftypetype=NL802154_IFTYPE_UNSPEC;__le64extended_addr=cpu_to_le64(0x0000000000000000ULL);+u32type=NL802154_IFTYPE_UNSPEC;/* TODO avoid failing a new interface*creationduetopendingremoval?
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:12
This patch fixes a null pointer derefence for panid handle by move the
check for the netlink variable directly before accessing them.
Reported-by: syzbot+d4c07de0144f6f63be3a@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl-mac.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:12
This patch stops dumping llsec keys for monitors which we don't support
yet. Otherwise we will access llsec mib which isn't initialized for
monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 5 +++++
1 file changed, 5 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:12
This patch forbids to add llsec key for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:30
This patch adds a missing consume_skb() when deliver a skb to upper
monitor interfaces of a wpan phy.
Reported-by: syzbot+44b651863a17760a893b@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/mac802154/rx.c | 2 ++
1 file changed, 2 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:30
This patch forbids to del llsec key for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:36
This patch stops dumping llsec devs for monitors which we don't support
yet. Otherwise we will access llsec mib which isn't initialized for
monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 5 +++++
1 file changed, 5 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:45
This patch forbids to set llsec params for monitor interfaces which we
don't support yet.
Reported-by: syzbot+8b6719da8a04beeafcc3@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:20:58
This patch forbids to del llsec dev for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:21:20
This patch stops dumping llsec devkeys for monitors which we don't support
yet. Otherwise we will access llsec mib which isn't initialized for
monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 5 +++++
1 file changed, 5 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:21:32
This patch forbids to add llsec devkey for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:21:51
This patch forbids to add llsec dev for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:22:00
This patch forbids to del llsec devkey for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:22:13
This patch stops dumping llsec seclevels for monitors which we don't
support yet. Otherwise we will access llsec mib which isn't initialized
for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 5 +++++
1 file changed, 5 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:22:30
This patch stops dumping llsec params for monitors which we don't support
yet. Otherwise we will access llsec mib which isn't initialized for
monitors.
Reported-by: syzbot+cde43a581a8e5f317bc2@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 5 +++++
1 file changed, 5 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:22:36
This patch forbids to del llsec seclevel for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Reported-by: syzbot+fbf4fc11a819824e027b@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <aahringo@redhat.com> Date: 2021-02-28 15:22:46
This patch forbids to add llsec seclevel for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <alex.aring@gmail.com> Date: 2021-03-01 03:17:35
Hi Stefan,
On Sun, 28 Feb 2021 at 10:21, Alexander Aring [off-list ref] wrote:
quoted hunk
This patch adds a missing consume_skb() when deliver a skb to upper
monitor interfaces of a wpan phy.
Reported-by: syzbot+44b651863a17760a893b@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/mac802154/rx.c | 2 ++
1 file changed, 2 insertions(+)
From: Stefan Schmidt <stefan@datenfreihafen.org> Date: 2021-03-03 04:10:58
Hello Alex.
On 01.03.21 04:16, Alexander Aring wrote:
Hi Stefan,
On Sun, 28 Feb 2021 at 10:21, Alexander Aring [off-list ref] wrote:
quoted
This patch adds a missing consume_skb() when deliver a skb to upper
monitor interfaces of a wpan phy.
Reported-by: syzbot+44b651863a17760a893b@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/mac802154/rx.c | 2 ++
1 file changed, 2 insertions(+)
From: Stefan Schmidt <stefan@datenfreihafen.org> Date: 2021-03-03 04:23:58
Hello Alex.
On 28.02.21 16:18, Alexander Aring wrote:
quoted hunk
This patch forbids to set llsec params for monitor interfaces which we
don't support yet.
Reported-by: syzbot+8b6719da8a04beeafcc3@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
@@ -1384,6 +1384,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb,u32changed=0;intret;+if(wpan_dev->iftype==NL802154_IFTYPE_MONITOR)+return-EOPNOTSUPP;+if(info->attrs[NL802154_ATTR_SEC_ENABLED]){u8enabled;
I am fine with this patch and all the rest up to 17. They just do not
apply for me with 1 and 2 left out and only 3 applied.
Could you resend 3-17 as a series and we can discuss 1 & 2 separately?
regards
Stefan Schmidt
From: Stefan Schmidt <stefan@datenfreihafen.org> Date: 2021-03-03 04:23:58
Hello Alex.
On 28.02.21 16:18, Alexander Aring wrote:
quoted hunk
This patch changes the iftype type variable to unsigned that it can
never be reach a negative value.
Reported-by: syzbot+7bf7b22759195c9a21e9@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -898,8 +898,8 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info)staticintnl802154_new_interface(structsk_buff*skb,structgenl_info*info){structcfg802154_registered_device*rdev=info->user_ptr[0];-enumnl802154_iftypetype=NL802154_IFTYPE_UNSPEC;__le64extended_addr=cpu_to_le64(0x0000000000000000ULL);+u32type=NL802154_IFTYPE_UNSPEC;/* TODO avoid failing a new interface*creationduetopendingremoval?
I am concerned about this one. Maybe you can shed some light on it.
NL802154_IFTYPE_UNSPEC is -1 which means the u32 will not hold this
value, but something at the end of the range for u32.
There is a path (info->attrs[NL802154_ATTR_IFTYPE] is not true) where we
put type forward to rdev_add_virtual_intf() with its changed value but
it would expect and enum which could hold -1 for UNSPEC.
regards
Stefan Schmidt
From: Stefan Schmidt <stefan@datenfreihafen.org> Date: 2021-03-03 04:23:58
Hello.
On 28.02.21 16:18, Alexander Aring wrote:
quoted hunk
This patch fixes a null pointer derefence for panid handle by move the
check for the netlink variable directly before accessing them.
Reported-by: syzbot+d4c07de0144f6f63be3a@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl-mac.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
From: Alexander Aring <alex.aring@gmail.com> Date: 2021-03-06 13:13:08
Hi,
On Thu, 4 Mar 2021 at 02:28, Stefan Schmidt [off-list ref] wrote:
Hello Alex.
On 28.02.21 16:18, Alexander Aring wrote:
quoted
This patch forbids to set llsec params for monitor interfaces which we
don't support yet.
Reported-by: syzbot+8b6719da8a04beeafcc3@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 3 +++
1 file changed, 3 insertions(+)
From: Alexander Aring <alex.aring@gmail.com> Date: 2021-03-06 23:42:28
Hi Stefan,
On Thu, 4 Mar 2021 at 02:28, Stefan Schmidt [off-list ref] wrote:
Hello Alex.
On 28.02.21 16:18, Alexander Aring wrote:
quoted
This patch changes the iftype type variable to unsigned that it can
never be reach a negative value.
Reported-by: syzbot+7bf7b22759195c9a21e9@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
net/ieee802154/nl802154.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -898,8 +898,8 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info)staticintnl802154_new_interface(structsk_buff*skb,structgenl_info*info){structcfg802154_registered_device*rdev=info->user_ptr[0];-enumnl802154_iftypetype=NL802154_IFTYPE_UNSPEC;__le64extended_addr=cpu_to_le64(0x0000000000000000ULL);+u32type=NL802154_IFTYPE_UNSPEC;/* TODO avoid failing a new interface*creationduetopendingremoval?
I am concerned about this one. Maybe you can shed some light on it.
NL802154_IFTYPE_UNSPEC is -1 which means the u32 will not hold this
value, but something at the end of the range for u32.
yes, ugh... it's NL802154_IFTYPE_UNSPEC = -1 only for
NL802154_IFTYPE... all others UNSPEC are 0. There is a comment there
/* for backwards compatibility TODO */. I think I did that because the
old netlink interfaces and instead of mapping new values to old values
(internally) which is bad.
Would it be 0 I think the compiler would handle it as unsigned.
There is a path (info->attrs[NL802154_ATTR_IFTYPE] is not true) where we
put type forward to rdev_add_virtual_intf() with its changed value but
it would expect and enum which could hold -1 for UNSPEC.
It will be converted back here to -1 again? Or maybe depends on the
compiler, because it may use a different int type which the enum
values fits? I am not sure here...
In nl802154 we use u32 (netlink) for enums because the range fits,
however this isn't true for NL802154_IFTYPE_, we cannot change it
back. I think we should try to switch NL802154_IFTYPE_UNSPEC to
"(~(__u32)0)" and let start NL802154_IFTYPE_NODE = 0. Which is still
backwards compatible. Just give the compiler a note to handle it as
unsigned value and more importantly an enum where the range fits in.
It depends on the compiler, may it decide to use a signed char for
this enum, then we get problems when converting it ? After quick
research it seems we can not rely on whatever the compiler handles the
enum as signed or unsigned and that makes problems with the shift
operator "BIT(type)" and it's what this patch is trying to fix. I
would make two patches, one is making the nl802154.h changes and the
other is this patch, should be fine to handle it as enum value when we
did some max range checks.
There is also a third patch to return -EINVAL earlier if type attr
isn't given, I think it's nothing for stable.
- Alex