From 6fec8ea84e9ade8fb5ae58a9d03242c86838c4de Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Mon, 16 Mar 2020 15:15:56 -0700 Subject: [PATCH] net: ieee802154: Fix possible null pointer de-reference ieee802154_scan() checks if ctx->scan_ctx (scan) is NULL what implies that this can be true, but de-reference this variable before this check what may cause a problem. Fixes #23299 [3] Signed-off-by: Flavio Ceolin --- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 61c45f2eab4..0fd6005c68e 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -97,6 +97,10 @@ static int ieee802154_scan(u32_t mgmt_request, struct net_if *iface, return -EALREADY; } + if (scan == NULL) { + return -EINVAL; + } + if (mgmt_request == NET_REQUEST_IEEE802154_ACTIVE_SCAN) { struct ieee802154_frame_params params;