linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid
@ 2021-04-12 16:27 Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 06/23] drivers: net: fix memory leak in atusb_probe Sasha Levin
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 3503c38954f9..76691a07a2e0 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -557,9 +557,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]);
@@ -568,6 +566,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 06/23] drivers: net: fix memory leak in atusb_probe
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 09/23] net: ieee802154: forbid monitor for set llsec params Sasha Levin
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 d5e0e2aedc55..9b3ab60c3556 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -340,6 +340,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 09/23] net: ieee802154: forbid monitor for set llsec params
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 06/23] drivers: net: fix memory leak in atusb_probe Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 10/23] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 16ef0d9f566e..746701424d79 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1367,6 +1367,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 10/23] net: ieee802154: stop dump llsec keys for monitors
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 06/23] drivers: net: fix memory leak in atusb_probe Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 09/23] net: ieee802154: forbid monitor for set llsec params Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 11/23] net: ieee802154: stop dump llsec devs " Sasha Levin
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 746701424d79..36f2d44a8753 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1476,6 +1476,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 11/23] net: ieee802154: stop dump llsec devs for monitors
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (2 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 10/23] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 12/23] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 36f2d44a8753..19a900292f20 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1651,6 +1651,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 12/23] net: ieee802154: forbid monitor for add llsec dev
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (3 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 11/23] net: ieee802154: stop dump llsec devs " Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 13/23] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 19a900292f20..8d22b1a68835 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1743,6 +1743,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 13/23] net: ieee802154: stop dump llsec devkeys for monitors
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (4 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 12/23] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 14/23] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 8d22b1a68835..db45cb0d20b2 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1831,6 +1831,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 14/23] net: ieee802154: forbid monitor for add llsec devkey
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (5 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 13/23] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 15/23] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 db45cb0d20b2..244fbbf3b58e 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1893,6 +1893,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(attrs, NL802154_DEVKEY_ATTR_MAX,
 			     info->attrs[NL802154_ATTR_SEC_DEVKEY],
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 15/23] net: ieee802154: stop dump llsec seclevels for monitors
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (6 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 14/23] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 16/23] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 244fbbf3b58e..5e6e8c80cc41 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2004,6 +2004,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 16/23] net: ieee802154: forbid monitor for add llsec seclevel
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (7 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 15/23] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 17/23] net: ieee802154: forbid monitor for del " Sasha Levin
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 5e6e8c80cc41..8173f9d2492b 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2094,6 +2094,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 17/23] net: ieee802154: forbid monitor for del llsec seclevel
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (8 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 16/23] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 18/23] net: ieee802154: stop dump llsec params for monitors Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 19/23] net: mac802154: Fix general protection fault Sasha Levin
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 8173f9d2492b..f0de6ea84124 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2112,6 +2112,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 18/23] net: ieee802154: stop dump llsec params for monitors
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (9 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 17/23] net: ieee802154: forbid monitor for del " Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 19/23] net: mac802154: Fix general protection fault Sasha Levin
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 f0de6ea84124..c3c0e989d728 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -843,8 +843,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] 13+ messages in thread

* [PATCH AUTOSEL 4.4 19/23] net: mac802154: Fix general protection fault
  2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
                   ` (10 preceding siblings ...)
  2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 18/23] net: ieee802154: stop dump llsec params for monitors Sasha Levin
@ 2021-04-12 16:27 ` Sasha Levin
  11 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2021-04-12 16:27 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 a13d02b7cee4..55ed8a97b33f 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -158,7 +158,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
 	crypto_free_blkcipher(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]);
 
 	kzfree(key);
-- 
2.30.2


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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 16:27 [PATCH AUTOSEL 4.4 01/23] net: ieee802154: nl-mac: fix check on panid Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 06/23] drivers: net: fix memory leak in atusb_probe Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 09/23] net: ieee802154: forbid monitor for set llsec params Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 10/23] net: ieee802154: stop dump llsec keys for monitors Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 11/23] net: ieee802154: stop dump llsec devs " Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 12/23] net: ieee802154: forbid monitor for add llsec dev Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 13/23] net: ieee802154: stop dump llsec devkeys for monitors Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 14/23] net: ieee802154: forbid monitor for add llsec devkey Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 15/23] net: ieee802154: stop dump llsec seclevels for monitors Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 16/23] net: ieee802154: forbid monitor for add llsec seclevel Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 17/23] net: ieee802154: forbid monitor for del " Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 18/23] net: ieee802154: stop dump llsec params for monitors Sasha Levin
2021-04-12 16:27 ` [PATCH AUTOSEL 4.4 19/23] 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).