From d23d16a6f68e249c4fdb772c74d5681dc02e0e42 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Tue, 17 Sep 2024 11:11:12 +0200 Subject: [PATCH] net: l2: ieee802154: fix deadlock When an incoming PAN ID does not match or when an error occurs while sending association requests, then locks were not properly released. Fixes #78717 Fixes #78495 Signed-off-by: Florian Grandel (cherry picked from commit 041d8c707cc69a1e6a214d943e4731868f1fae0d) --- subsys/net/l2/ieee802154/ieee802154.c | 2 +- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/ieee802154/ieee802154.c b/subsys/net/l2/ieee802154/ieee802154.c index 09fdf8d28cfc9c7..bc9af9700bd2aa6 100644 --- a/subsys/net/l2/ieee802154/ieee802154.c +++ b/subsys/net/l2/ieee802154/ieee802154.c @@ -317,7 +317,7 @@ static bool ieeee802154_check_dst_addr(struct net_if *iface, struct ieee802154_m if (!(dst_plain->pan_id == IEEE802154_BROADCAST_PAN_ID || dst_plain->pan_id == sys_cpu_to_le16(ctx->pan_id))) { LOG_DBG("Frame PAN ID does not match!"); - return false; + goto out; } if (mhr->fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_SHORT) { diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index f9dd3dd5c6a6b96..29f1c7332ae3c26 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -555,6 +555,7 @@ static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, if (ieee802154_radio_send(iface, pkt, pkt->buffer)) { net_pkt_unref(pkt); ret = -EIO; + k_sem_give(&ctx->scan_ctx_lock); goto out; }