lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210405195744.19386-1-paskripkin@gmail.com>
Date:   Mon,  5 Apr 2021 22:57:44 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     alex.aring@...il.com, stefan@...enfreihafen.org,
        davem@...emloft.net
Cc:     linux-wpan@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Pavel Skripkin <paskripkin@...il.com>,
        syzbot+7bf7b22759195c9a21e9@...kaller.appspotmail.com
Subject: [PATCH] net: fix shift-out-of-bounds in nl802154_new_interface

syzbot reported shift-out-of-bounds in nl802154_new_interface.
The problem was in signed representation of enum nl802154_iftype

enum nl802154_iftype {
	/* for backwards compatibility TODO */
	NL802154_IFTYPE_UNSPEC = -1,
...

Since, enum has negative value in it, objects of this type
will be represented as signed integer.

	type = nla_get_u32(info->attrs[NL802154_ATTR_IFTYPE]);

u32 will be casted to signed, which can cause negative value type.

Reported-by: syzbot+7bf7b22759195c9a21e9@...kaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
---
 net/ieee802154/nl802154.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 7c5a1aa5adb4..6cce045e3d40 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -910,7 +910,7 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
 
 	if (info->attrs[NL802154_ATTR_IFTYPE]) {
 		type = nla_get_u32(info->attrs[NL802154_ATTR_IFTYPE]);
-		if (type > NL802154_IFTYPE_MAX ||
+		if (type > NL802154_IFTYPE_MAX || type < 0 ||
 		    !(rdev->wpan_phy.supported.iftypes & BIT(type)))
 			return -EINVAL;
 	}
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ