summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2023-03-01 16:44:50 +0100
committerStefan Schmidt <stefan@datenfreihafen.org>2023-03-02 14:39:48 +0100
commit02f18662f6c671382345fcb696e808d78f4c194a (patch)
tree3758ec8613ed2cbed5788b9a2fde6455470d23fb /net
parent6c993779ea1d0cccdb3a5d7d45446dd229e610a3 (diff)
downloadlinux-stable-02f18662f6c671382345fcb696e808d78f4c194a.tar.gz
linux-stable-02f18662f6c671382345fcb696e808d78f4c194a.tar.bz2
linux-stable-02f18662f6c671382345fcb696e808d78f4c194a.zip
ieee802154: Prevent user from crashing the host
Avoid crashing the machine by checking info->attrs[NL802154_ATTR_SCAN_TYPE] presence before de-referencing it, which was the primary intend of the blamed patch. Reported-by: Sanan Hasanov <sanan.hasanov@Knights.ucf.edu> Suggested-by: Eric Dumazet <edumazet@google.com> Fixes: a0b6106672b5 ("ieee802154: Convert scan error messages to extack") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20230301154450.547716-1-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/nl802154.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 2215f576ee37..d8f4379d4fa6 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1412,7 +1412,7 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
return -EOPNOTSUPP;
}
- if (!nla_get_u8(info->attrs[NL802154_ATTR_SCAN_TYPE])) {
+ if (!info->attrs[NL802154_ATTR_SCAN_TYPE]) {
NL_SET_ERR_MSG(info->extack, "Malformed request, missing scan type");
return -EINVAL;
}