mac802154_process_association_req() runs from the rx_mac_cmd workqueue. The missing RTNL was identified during an LLM-assisted code audit of the mac802154 association handling path. The function builds the ASSOC RESP and sends it through mac802154_send_association_resp_locked() -> ieee802154_mlme_tx_locked(), which asserts the RTNL and calls ieee802154_sync_queue(). The worker does not hold the RTNL: this triggers an RTNL assertion failure whenever an ASSOC REQ reaches the response transmission path. With panic_on_warn=1 a single unauthenticated frame panics the kernel, even with max_associations=0 (a rejected request still sends a response). Take the RTNL before association_lock, matching the netlink lock order (RTNL then association_lock), and release it after the association lock on all exits. Reproduced with a monitor/coordinator pair on mac802154_hwsim; the same test is silent with this patch. On a CONFIG_PROVE_LOCKING kernel 86,891 association requests were sent while the coordinator was brought down and up 1,200 times and recreated 71 times: no lockdep report, no hang and no warning, and the longest down transition took about 4 ms. The panic_on_warn run (22,941 requests, 300 down/up cycles) also completed. There is no in-tree selftest for this path; the checks above use a dedicated hwsim harness. Fixes: 601f160b61b2 ("mac802154: Handle association requests from peers") Signed-off-by: Lee Keon-Hyeong --- net/mac802154/scan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c index d393b1f4e..49bc5d29b 100644 --- a/net/mac802154/scan.c +++ b/net/mac802154/scan.c @@ -826,6 +826,11 @@ int mac802154_process_association_req(struct ieee802154_sub_if_data *sdata, return -ENODEV; } + /* mac802154_send_association_resp_locked() uses the MLME TX helpers, + * which require the RTNL. Take it before association_lock to keep the + * same lock order as the netlink paths (RTNL then association_lock). + */ + rtnl_lock(); mutex_lock(&wpan_dev->association_lock); memcpy(&assoc_req_pl, skb->data, sizeof(assoc_req_pl)); @@ -895,6 +900,7 @@ int mac802154_process_association_req(struct ieee802154_sub_if_data *sdata, unlock: mutex_unlock(&wpan_dev->association_lock); + rtnl_unlock(); return ret; } -- 2.55.0