Commit 02f18662 authored by Miquel Raynal's avatar Miquel Raynal Committed by Stefan Schmidt

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: default avatarSanan Hasanov <sanan.hasanov@Knights.ucf.edu>
Suggested-by: default avatarEric Dumazet <edumazet@google.com>
Fixes: a0b61066 ("ieee802154: Convert scan error messages to extack")
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20230301154450.547716-1-miquel.raynal@bootlin.comSigned-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
parent 6c993779
...@@ -1412,7 +1412,7 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -1412,7 +1412,7 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
return -EOPNOTSUPP; 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"); NL_SET_ERR_MSG(info->extack, "Malformed request, missing scan type");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment