This is a note to let you know that I've just added the patch titled net: ieee802154: nl-mac: fix check on panid to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-ieee802154-nl-mac-fix-check-on-panid.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6f7f657f24405f426212c09260bf7fe8a52cef33 Mon Sep 17 00:00:00 2001 From: Alexander Aring <aahringo@xxxxxxxxxx> Date: Sun, 28 Feb 2021 10:18:03 -0500 Subject: net: ieee802154: nl-mac: fix check on panid From: Alexander Aring <aahringo@xxxxxxxxxx> commit 6f7f657f24405f426212c09260bf7fe8a52cef33 upstream. 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@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx> Link: https://lore.kernel.org/r/20210228151817.95700-4-aahringo@xxxxxxxxxx Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/ieee802154/nl-mac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c @@ -559,9 +559,7 @@ ieee802154_llsec_parse_key_id(struct gen 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]); @@ -570,6 +568,9 @@ ieee802154_llsec_parse_key_id(struct gen 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]); } Patches currently in stable-queue which might be from aahringo@xxxxxxxxxx are queue-4.9/net-ieee802154-fix-nl802154-del-llsec-devkey.patch queue-4.9/net-ieee802154-fix-nl802154-del-llsec-key.patch queue-4.9/net-ieee802154-forbid-monitor-for-del-llsec-seclevel.patch queue-4.9/net-ieee802154-fix-nl802154-add-llsec-key.patch queue-4.9/net-ieee802154-forbid-monitor-for-set-llsec-params.patch queue-4.9/net-ieee802154-nl-mac-fix-check-on-panid.patch queue-4.9/net-mac802154-fix-general-protection-fault.patch queue-4.9/net-ieee802154-fix-nl802154-del-llsec-dev.patch queue-4.9/net-ieee802154-stop-dump-llsec-params-for-monitors.patch