Netdev List
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Lee Keon-Hyeong <leegun25@proton.me>
Cc: alex.aring@gmail.com,  stefan@datenfreihafen.org,
	linux-wpan@vger.kernel.org,  netdev@vger.kernel.org
Subject: Re: [PATCH net] mac802154: take RTNL around ASSOC RESP transmission
Date: Tue, 24 Nov 2026 19:48:06 +0100	[thread overview]
Message-ID: <87se0qqd5l.fsf@bootlin.com> (raw)
In-Reply-To: <20261121150835.256812-1-leegun25@proton.me> (Lee Keon-Hyeong's message of "Sat, 21 Nov 2026 15:08:43 +0000")

On 21/11/2026 at 15:08:43 GMT, Lee Keon-Hyeong <leegun25@proton.me> wrote:

> 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.

Ok, we can definitely align on the observation but the approach may not
stand.

First let's approach the numbers. 4ms is on a locally run simulator. You
are fixing a subsystem that plays with radios. A physical IEEE802154
radio would probably bring the usual bad case to > 100ms, and worth case
would be above the 1s boundary. So taking the RTNL lock as you do it
there would no longer warn in dev mode, but might lead to a DoS.

Reviewing your patch makes me realize we do something even worse: up to
10s waiting with the RTNL when waiting for an association response (for
which we are ouselves the initiator). That is slightly less a problem
since it is not remotely triggerable like the approach you propose, but
still.

I don't remember why we *had* to take the RTNL in the mlme_tx path.

Alex, maybe you remember why?

Thanks,
Miquèl

      reply	other threads:[~2026-11-24 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 15:08 [PATCH net] mac802154: take RTNL around ASSOC RESP transmission Lee Keon-Hyeong
2026-11-24 18:48 ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87se0qqd5l.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=leegun25@proton.me \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox