All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Alexander Popov <alex.popov@linux.com>
Cc: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Michal Kubecek <mkubecek@suse.cz>, Gal Pressman <gal@nvidia.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Ido Schimmel <idosch@nvidia.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	security@kernel.org, notify@kernel.org
Subject: Re: [PATCH] ethtool: don't touch the parent device of a net device being unregistered
Date: Mon, 23 Mar 2026 15:08:27 -0700	[thread overview]
Message-ID: <20260323150827.24a6259c@kernel.org> (raw)
In-Reply-To: <eff8cf89-fc3a-4aa1-bcfa-c939c9e7d853@linux.com>

On Mon, 23 Mar 2026 02:08:53 +0300 Alexander Popov wrote:
> Hello Andrew, let me describe the scenario that I see:
> 
>   - The netdev_run_todo() function handles the net devices in net_todo_list
>     in a loop and moves each of them into the NETREG_UNREGISTERED state:
>       netdev_lock(dev);
>       WRITE_ONCE(dev->reg_state, NETREG_UNREGISTERED);
>       netdev_unlock(dev);
> 
>   - Then netdev_run_todo() frees these net devices in another loop.
>     On each iteration, it chooses a device for freeing:
>       dev = netdev_wait_allrefs_any(&list);
> 
>   - At the same time, the ethnl_set_features() function calls
>     ethnl_parse_header_dev_get() for the child net device.
> 
>   - If the race condition succeeds, ethnl_set_features() takes the reference
>     to the child net device being unregistered. That makes netdev_run_todo()
>     free the parent first.

That's not sufficient detail. ethnl_parse_header_dev_get() is under RCU
and unregistration does an RCU sync after delisting the device. Also
not sure you're distinguishing struct net_device and struct device.

How did you hit this issue? What are the net devices involved?

  reply	other threads:[~2026-03-23 22:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-22  7:59 [PATCH] ethtool: don't touch the parent device of a net device being unregistered Alexander Popov
2026-03-22 14:39 ` Andrew Lunn
2026-03-22 23:08   ` Alexander Popov
2026-03-23 22:08     ` Jakub Kicinski [this message]
2026-03-24 18:46       ` Alexander Popov
2026-03-29  8:47         ` Alexander Popov
2026-03-29 13:52           ` Andrew Lunn
2026-03-29 17:54           ` Jakub Kicinski

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=20260323150827.24a6259c@kernel.org \
    --to=kuba@kernel.org \
    --cc=alex.popov@linux.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kory.maincent@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=notify@kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=security@kernel.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.