linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key
@ 2021-04-12 16:23 Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 02/46] net: ieee802154: fix nl802154 del llsec dev Sasha Levin
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+ac5c11d2959a8b3c4806, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 37feaaf5ceb2245e474369312bb7b922ce7bce69 ]

This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_KEY is
not set by the user. If this is the case nl802154 will return -EINVAL.

Reported-by: syzbot+ac5c11d2959a8b3c4806@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210221174321.14210-1-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 7c5a1aa5adb4..2f0a138bd5eb 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1592,7 +1592,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
 	struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1];
 	struct ieee802154_llsec_key_id id;
 
-	if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
+	if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
+	    nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
 		return -EINVAL;
 
 	if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0)
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 02/46] net: ieee802154: fix nl802154 del llsec dev
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 03/46] net: ieee802154: fix nl802154 add llsec key Sasha Levin
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+d946223c2e751d136c94, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 3d1eac2f45585690d942cf47fd7fbd04093ebd1b ]

This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_DEVICE is
not set by the user. If this is the case nl802154 will return -EINVAL.

Reported-by: syzbot+d946223c2e751d136c94@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210221174321.14210-2-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 2f0a138bd5eb..063b12cba71f 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1758,7 +1758,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
 	struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1];
 	__le64 extended_addr;
 
-	if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack))
+	if (!info->attrs[NL802154_ATTR_SEC_DEVICE] ||
+	    nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack))
 		return -EINVAL;
 
 	if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR])
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 03/46] net: ieee802154: fix nl802154 add llsec key
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 02/46] net: ieee802154: fix nl802154 del llsec dev Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 04/46] net: ieee802154: fix nl802154 del llsec devkey Sasha Levin
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+ce4e062c2d51977ddc50, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 20d5fe2d7103f5c43ad11a3d6d259e9d61165c35 ]

This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_KEY is
not set by the user. If this is the case nl802154 will return -EINVAL.

Reported-by: syzbot+ce4e062c2d51977ddc50@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210221174321.14210-3-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 063b12cba71f..3f6d86d63923 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1544,7 +1544,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
 	struct ieee802154_llsec_key_id id = { };
 	u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { };
 
-	if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
+	if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
+	    nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
 		return -EINVAL;
 
 	if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] ||
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 04/46] net: ieee802154: fix nl802154 del llsec devkey
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 02/46] net: ieee802154: fix nl802154 del llsec dev Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 03/46] net: ieee802154: fix nl802154 add llsec key Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 05/46] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+368672e0da240db53b5f, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 27c746869e1a135dffc2f2a80715bb7aa00445b4 ]

This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_DEVKEY is
not set by the user. If this is the case nl802154 will return -EINVAL.

Reported-by: syzbot+368672e0da240db53b5f@syzkaller.appspotmail.com
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210221174321.14210-4-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 3f6d86d63923..e9e4652cd592 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1916,7 +1916,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
 	struct ieee802154_llsec_device_key key;
 	__le64 extended_addr;
 
-	if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack))
+	if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
+	    nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack))
 		return -EINVAL;
 
 	if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR])
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 05/46] net: ieee802154: nl-mac: fix check on panid
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (2 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 04/46] net: ieee802154: fix nl802154 del llsec devkey Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 18/46] drivers: net: fix memory leak in atusb_probe Sasha Levin
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+d4c07de0144f6f63be3a, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 6f7f657f24405f426212c09260bf7fe8a52cef33 ]

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>
Link: https://lore.kernel.org/r/20210228151817.95700-4-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl-mac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index 6d091e419d3e..d19c40c684e8 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
 	desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]);
 
 	if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) {
-		if (!info->attrs[IEEE802154_ATTR_PAN_ID] &&
-		    !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] ||
-		      info->attrs[IEEE802154_ATTR_HW_ADDR]))
+		if (!info->attrs[IEEE802154_ATTR_PAN_ID])
 			return -EINVAL;
 
 		desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]);
@@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
 			desc->device_addr.mode = IEEE802154_ADDR_SHORT;
 			desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]);
 		} else {
+			if (!info->attrs[IEEE802154_ATTR_HW_ADDR])
+				return -EINVAL;
+
 			desc->device_addr.mode = IEEE802154_ADDR_LONG;
 			desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]);
 		}
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 18/46] drivers: net: fix memory leak in atusb_probe
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (3 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 05/46] net: ieee802154: nl-mac: fix check on panid Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 24/46] net: ieee802154: forbid monitor for set llsec params Sasha Levin
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Pavel Skripkin, syzbot+28a246747e0a465127f3, David S . Miller,
	Sasha Levin, linux-wpan, netdev

From: Pavel Skripkin <paskripkin@gmail.com>

[ Upstream commit 6b9fbe16955152626557ec6f439f3407b7769941 ]

syzbot reported memory leak in atusb_probe()[1].
The problem was in atusb_alloc_urbs().
Since urb is anchored, we need to release the reference
to correctly free the urb

backtrace:
    [<ffffffff82ba0466>] kmalloc include/linux/slab.h:559 [inline]
    [<ffffffff82ba0466>] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74
    [<ffffffff82ad3888>] atusb_alloc_urbs drivers/net/ieee802154/atusb.c:362 [inline][2]
    [<ffffffff82ad3888>] atusb_probe+0x158/0x820 drivers/net/ieee802154/atusb.c:1038 [1]

Reported-by: syzbot+28a246747e0a465127f3@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ieee802154/atusb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 0dd0ba915ab9..23ee0b14cbfa 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n)
 			return -ENOMEM;
 		}
 		usb_anchor_urb(urb, &atusb->idle_urbs);
+		usb_free_urb(urb);
 		n--;
 	}
 	return 0;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 24/46] net: ieee802154: forbid monitor for set llsec params
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (4 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 18/46] drivers: net: fix memory leak in atusb_probe Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 25/46] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+8b6719da8a04beeafcc3, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 88c17855ac4291fb462e13a86b7516773b6c932e ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-3-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index e9e4652cd592..dd43aa03200e 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1384,6 +1384,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb,
 	u32 changed = 0;
 	int ret;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (info->attrs[NL802154_ATTR_SEC_ENABLED]) {
 		u8 enabled;
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 25/46] net: ieee802154: stop dump llsec keys for monitors
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (5 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 24/46] net: ieee802154: forbid monitor for set llsec params Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 26/46] net: ieee802154: forbid monitor for add llsec key Sasha Levin
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit fb3c5cdf88cd504ef11d59e8d656f4bc896c6922 ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-4-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index dd43aa03200e..c85e4230ec60 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1493,6 +1493,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)
 	if (err)
 		return err;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
+		err = skb->len;
+		goto out_err;
+	}
+
 	if (!wpan_dev->netdev) {
 		err = -EINVAL;
 		goto out_err;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 26/46] net: ieee802154: forbid monitor for add llsec key
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (6 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 25/46] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 27/46] net: ieee802154: forbid monitor for del " Sasha Levin
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 08470c5453339369bd3d590c4cbb0b5961cdcbb6 ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-5-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index c85e4230ec60..c10fc3479d3e 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1552,6 +1552,9 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
 	struct ieee802154_llsec_key_id id = { };
 	u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { };
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
 	    nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 27/46] net: ieee802154: forbid monitor for del llsec key
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (7 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 26/46] net: ieee802154: forbid monitor for add llsec key Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 28/46] net: ieee802154: stop dump llsec devs for monitors Sasha Levin
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit b6e2949544a183f590ae6f3ef2d1aaaa2c44e38a ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-6-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index c10fc3479d3e..9cdc1457c97c 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1604,6 +1604,9 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
 	struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1];
 	struct ieee802154_llsec_key_id id;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
 	    nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 28/46] net: ieee802154: stop dump llsec devs for monitors
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (8 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 27/46] net: ieee802154: forbid monitor for del " Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 29/46] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 5582d641e6740839c9b83efd1fbf9bcd00b6f5fc ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-7-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 9cdc1457c97c..39a81602e5b5 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1672,6 +1672,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)
 	if (err)
 		return err;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
+		err = skb->len;
+		goto out_err;
+	}
+
 	if (!wpan_dev->netdev) {
 		err = -EINVAL;
 		goto out_err;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 29/46] net: ieee802154: forbid monitor for add llsec dev
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (9 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 28/46] net: ieee802154: stop dump llsec devs for monitors Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 30/46] net: ieee802154: forbid monitor for del " Sasha Levin
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 5303f956b05a2886ff42890908156afaec0f95ac ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-8-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 39a81602e5b5..29aaeb094959 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1763,6 +1763,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info)
 	struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
 	struct ieee802154_llsec_device dev_desc;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (ieee802154_llsec_parse_device(info->attrs[NL802154_ATTR_SEC_DEVICE],
 					  &dev_desc) < 0)
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 30/46] net: ieee802154: forbid monitor for del llsec dev
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (10 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 29/46] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 31/46] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit ad8f9de1f3566686af35b1c6b43240726541da61 ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-9-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 29aaeb094959..5c386575aec0 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1781,6 +1781,9 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
 	struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1];
 	__le64 extended_addr;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_DEVICE] ||
 	    nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack))
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 31/46] net: ieee802154: stop dump llsec devkeys for monitors
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (11 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 30/46] net: ieee802154: forbid monitor for del " Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 32/46] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 080d1a57a94d93e70f84b7a360baa351388c574f ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-10-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 5c386575aec0..f63fbb237be8 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1853,6 +1853,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
 	if (err)
 		return err;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
+		err = skb->len;
+		goto out_err;
+	}
+
 	if (!wpan_dev->netdev) {
 		err = -EINVAL;
 		goto out_err;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 32/46] net: ieee802154: forbid monitor for add llsec devkey
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (12 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 31/46] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 33/46] net: ieee802154: forbid monitor for del " Sasha Levin
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit a347b3b394868fef15b16f143719df56184be81d ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-11-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index f63fbb237be8..1e437de5e7c9 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1915,6 +1915,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info
 	struct ieee802154_llsec_device_key key;
 	__le64 extended_addr;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
 	    nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0)
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 33/46] net: ieee802154: forbid monitor for del llsec devkey
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (13 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 32/46] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 34/46] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 6fb8045319ef172dc88a8142e7f8b58c7608137e ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-12-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 1e437de5e7c9..f1f3af618039 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1949,6 +1949,9 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
 	struct ieee802154_llsec_device_key key;
 	__le64 extended_addr;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
 	    nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack))
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 34/46] net: ieee802154: stop dump llsec seclevels for monitors
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (14 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 33/46] net: ieee802154: forbid monitor for del " Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 35/46] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 4c9b4f55ad1f5a4b6206ac4ea58f273126d21925 ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-13-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index f1f3af618039..6a39fb7c0c46 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2026,6 +2026,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)
 	if (err)
 		return err;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
+		err = skb->len;
+		goto out_err;
+	}
+
 	if (!wpan_dev->netdev) {
 		err = -EINVAL;
 		goto out_err;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 35/46] net: ieee802154: forbid monitor for add llsec seclevel
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (15 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 34/46] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 36/46] net: ieee802154: forbid monitor for del " Sasha Levin
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 9ec87e322428d4734ac647d1a8e507434086993d ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-14-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 6a39fb7c0c46..c2e9d133e5fc 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2115,6 +2115,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb,
 	struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
 	struct ieee802154_llsec_seclevel sl;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
 				 &sl) < 0)
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 36/46] net: ieee802154: forbid monitor for del llsec seclevel
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (16 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 35/46] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 37/46] net: ieee802154: stop dump llsec params for monitors Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 38/46] net: mac802154: Fix general protection fault Sasha Levin
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+fbf4fc11a819824e027b, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 9dde130937e95b72adfae64ab21d6e7e707e2dac ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-15-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index c2e9d133e5fc..edd09eb7bf6d 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2133,6 +2133,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb,
 	struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
 	struct ieee802154_llsec_seclevel sl;
 
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		return -EOPNOTSUPP;
+
 	if (!info->attrs[NL802154_ATTR_SEC_LEVEL] ||
 	    llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
 				 &sl) < 0)
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 37/46] net: ieee802154: stop dump llsec params for monitors
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (17 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 36/46] net: ieee802154: forbid monitor for del " Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 38/46] net: mac802154: Fix general protection fault Sasha Levin
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Aring, syzbot+cde43a581a8e5f317bc2, Stefan Schmidt,
	Sasha Levin, linux-wpan, netdev

From: Alexander Aring <aahringo@redhat.com>

[ Upstream commit 1534efc7bbc1121e92c86c2dabebaf2c9dcece19 ]

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>
Link: https://lore.kernel.org/r/20210405003054.256017-16-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ieee802154/nl802154.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index edd09eb7bf6d..f0b47d43c9f6 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
 		goto nla_put_failure;
 
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
+	if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+		goto out;
+
 	if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0)
 		goto nla_put_failure;
+
+out:
 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
 
 	genlmsg_end(msg, hdr);
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 38/46] net: mac802154: Fix general protection fault
  2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
                   ` (18 preceding siblings ...)
  2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 37/46] net: ieee802154: stop dump llsec params for monitors Sasha Levin
@ 2021-04-12 16:23 ` Sasha Levin
  19 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2021-04-12 16:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Pavel Skripkin, syzbot+9ec037722d2603a9f52e, Alexander Aring,
	Stefan Schmidt, Sasha Levin, linux-wpan, netdev

From: Pavel Skripkin <paskripkin@gmail.com>

[ Upstream commit 1165affd484889d4986cf3b724318935a0b120d8 ]

syzbot found general protection fault in crypto_destroy_tfm()[1].
It was caused by wrong clean up loop in llsec_key_alloc().
If one of the tfm array members is in IS_ERR() range it will
cause general protection fault in clean up function [1].

Call Trace:
 crypto_free_aead include/crypto/aead.h:191 [inline] [1]
 llsec_key_alloc net/mac802154/llsec.c:156 [inline]
 mac802154_llsec_key_add+0x9e0/0xcc0 net/mac802154/llsec.c:249
 ieee802154_add_llsec_key+0x56/0x80 net/mac802154/cfg.c:338
 rdev_add_llsec_key net/ieee802154/rdev-ops.h:260 [inline]
 nl802154_add_llsec_key+0x3d3/0x560 net/ieee802154/nl802154.c:1584
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739
 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:674
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reported-by: syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210304152125.1052825-1-paskripkin@gmail.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac802154/llsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index 585d33144c33..55550ead2ced 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -152,7 +152,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
 	crypto_free_sync_skcipher(key->tfm0);
 err_tfm:
 	for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
-		if (key->tfm[i])
+		if (!IS_ERR_OR_NULL(key->tfm[i]))
 			crypto_free_aead(key->tfm[i]);
 
 	kfree_sensitive(key);
-- 
2.30.2


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

end of thread, other threads:[~2021-04-12 16:28 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 16:23 [PATCH AUTOSEL 5.10 01/46] net: ieee802154: fix nl802154 del llsec key Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 02/46] net: ieee802154: fix nl802154 del llsec dev Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 03/46] net: ieee802154: fix nl802154 add llsec key Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 04/46] net: ieee802154: fix nl802154 del llsec devkey Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 05/46] net: ieee802154: nl-mac: fix check on panid Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 18/46] drivers: net: fix memory leak in atusb_probe Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 24/46] net: ieee802154: forbid monitor for set llsec params Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 25/46] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 26/46] net: ieee802154: forbid monitor for add llsec key Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 27/46] net: ieee802154: forbid monitor for del " Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 28/46] net: ieee802154: stop dump llsec devs for monitors Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 29/46] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 30/46] net: ieee802154: forbid monitor for del " Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 31/46] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 32/46] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 33/46] net: ieee802154: forbid monitor for del " Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 34/46] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 35/46] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 36/46] net: ieee802154: forbid monitor for del " Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 37/46] net: ieee802154: stop dump llsec params for monitors Sasha Levin
2021-04-12 16:23 ` [PATCH AUTOSEL 5.10 38/46] net: mac802154: Fix general protection fault Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).