]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: ieee802154: forbid monitor for add llsec devkey
authorAlexander Aring <aahringo@redhat.com>
Mon, 5 Apr 2021 00:30:49 +0000 (20:30 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:53:56 +0000 (09:53 +0200)
BugLink: https://bugs.launchpad.net/bugs/1926999
[ Upstream commit a347b3b394868fef15b16f143719df56184be81d ]

This patch forbids to add llsec devkey for monitor interfaces which we
don't support yet. Otherwise we will access llsec mib which isn't
initialized for monitors.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20210405003054.256017-11-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ieee802154/nl802154.c

index 40022e137094a56a8dfd3750bd1d378427efb86b..023c1e75daf9436c4c8c0e1fc8af690464bb7183 100644 (file)
@@ -1920,6 +1920,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info
        struct ieee802154_llsec_device_key key;
        __le64 extended_addr;
 
+       if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
+               return -EOPNOTSUPP;
+
        if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
            nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0)
                return -EINVAL;