All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Ibrahim Hashimov <security@auditcode.ai>
Cc: Alexander Aring <alex.aring@gmail.com>,
	 Stefan Schmidt <stefan@datenfreihafen.org>,
	 "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>,
	linux-wpan@vger.kernel.org,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,  stable@vger.kernel.org
Subject: Re: [PATCH net] mac802154: hold an interface reference across the scan worker
Date: Fri, 17 Jul 2026 10:57:14 +0200	[thread overview]
Message-ID: <878q7akn85.fsf@bootlin.com> (raw)
In-Reply-To: <20260710140927.13228-1-security@auditcode.ai> (Ibrahim Hashimov's message of "Fri, 10 Jul 2026 16:09:27 +0200")

Hi Ibrahim,

> +	/* From here on sdata->dev is dereferenced after rcu_read_unlock() and
> +	 * outside the rtnl: in the dev_err()/dev_dbg() traces below, in
> +	 * mac802154_transmit_beacon_req() (skb->dev = sdata->dev) and in the
> +	 * end_scan mac802154_scan_cleanup_locked() call. A concurrent teardown
> +	 * of that interface (NL802154_CMD_DEL_INTERFACE ->
> +	 * ieee802154_if_remove(), or a full PHY removal via
> +	 * ieee802154_unregister_hw()) can unregister the netdev; the actual
> +	 * free then runs asynchronously from netdev_run_todo() with the rtnl
> +	 * already dropped, so neither holding the rtnl nor the per-PHY
> +	 * IEEE802154_IS_SCANNING flag keeps sdata->dev alive here. Pin it with
> +	 * a reference taken while we still hold the RCU read lock (so the
> +	 * netdev cannot be freed before we bump the refcount) and drop it at
> +	 * every exit below. This blocks the teardown's netdev_run_todo() until
> +	 * this worker iteration is done; it cannot self-deadlock because the
> +	 * unregistering task claims the net_todo_list entry under the rtnl, so
> +	 * the blocking netdev_wait_allrefs_any() always runs on that task, not
> +	 * on this single-threaded worker.
> +	 */

The patch seems correct, the fix as well, but can we trim down this huge
comment please?

Thanks,
Miquèl

  reply	other threads:[~2026-07-17  8:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 14:09 [PATCH net] mac802154: hold an interface reference across the scan worker Ibrahim Hashimov
2026-07-17  8:57 ` Miquel Raynal [this message]
2026-07-17 10:58 ` [PATCH v2] " Ibrahim Hashimov
2026-07-17 11:37   ` Miquel Raynal

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=878q7akn85.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=security@auditcode.ai \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.