Skip to content

net: l2: ieee802154: ctx_lock taken but not given #78495

Closed
@lorc-dev

Description

@lorc-dev

Describe the bug
In ieeee802154_check_dst_addr() the ctx_lock is taken but not given when the PAN ID doesn't match.

Fix:

diff --git a/subsys/net/l2/ieee802154/ieee802154.c b/subsys/net/l2/ieee802154/ieee802154.c
--- a/subsys/net/l2/ieee802154/ieee802154.c	(revision 34982bb00b57486aeb83a6cb3bb7433791302aed)
+++ b/subsys/net/l2/ieee802154/ieee802154.c	(date 1726234192944)
@@ -317,7 +317,8 @@
 	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;
+		ret = false;
+		goto out;
 	}
 
 	if (mhr->fs->fc.dst_addr_mode == IEEE802154_ADDR_MODE_SHORT) {

Similar issue in ieee802154_associate(), scan_ctx_lock is taken but not given when ieee802154_radio_send() fails.

diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c
--- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c	(revision 34982bb00b57486aeb83a6cb3bb7433791302aed)
+++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c	(date 1725975715608)
@@ -567,6 +567,7 @@
 	if (ieee802154_radio_send(iface, pkt, pkt->buffer)) {
 		net_pkt_unref(pkt);
 		ret = -EIO;
+		k_sem_give(&ctx->scan_ctx_lock);
 		NET_ERR("Could not associate: cannot send association request");
 		goto out;
 	}

Environment (please complete the following information):

  • OS: Windows
  • Zephyr SDK 0.16.8
  • 34982bb

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions