Skip to content

Commit

Permalink
ieee802154: Prevent user from crashing the host
Browse files Browse the repository at this point in the history
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: a0b6106 ("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>
  • Loading branch information
Miquel Raynal authored and Stefan Schmidt committed Mar 2, 2023
1 parent 6c99377 commit 02f1866
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ieee802154/nl802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 02f1866

Please sign in to comment.