From: Kory Maincent <kory.maincent@bootlin.com>
To: Carlo Szelinsky <github@szelinsky.de>,
Oleksij Rempel <o.rempel@pengutronix.de>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Jonas Jelonek <jelonek.jonas@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3 3/3] net: pse-pd: unregister from the controller list before freeing PI data
Date: Tue, 18 Aug 2026 15:18:06 +0200 [thread overview]
Message-ID: <48761981-fd4d-4cd6-b4e3-cb575bb34349@bootlin.com> (raw)
In-Reply-To: <20260813200653.980170-4-github@szelinsky.de>
On 8/13/26 22:06, Carlo Szelinsky wrote:
> pse_controller_unregister() frees the PI array with pse_release_pis()
> while the controller is still linked on pse_controller_list, and only
> removes it from the list afterwards. A concurrent consumer probe running
> of_pse_control_get() walks that list under pse_list_mutex and calls
> of_pse_match_pi(), which dereferences pcdev->pi[i].np. If the walk lands
> on a controller that is being torn down, it reads the freed (with the
> previous patch, NULLed) PI array.
>
> Move the list_del() ahead of pse_release_pis(). Both the lookup and the
> removal serialise on pse_list_mutex, so once the controller is unlinked
> no new lookup can reach it, and any lookup already in progress holds the
> mutex and has matched against a live pi before the free can run. No NULL
> checks are needed on the lookup path.
>
> Fixes: 9be9567a7c59 ("net: pse-pd: Add support for PSE PIs")
> Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Thank you!
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
prev parent reply other threads:[~2026-08-18 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 20:06 [PATCH net v3 0/3] net: pse-pd: fix use-after-free of PI array on controller unregister Carlo Szelinsky
2026-08-13 20:06 ` [PATCH net v3 1/3] net: pse-pd: stop async event sources before freeing PI data in unregister Carlo Szelinsky
2026-08-13 20:06 ` [PATCH net v3 2/3] net: pse-pd: guard regulator ops against freed PI data during unregister Carlo Szelinsky
2026-08-13 20:06 ` [PATCH net v3 3/3] net: pse-pd: unregister from the controller list before freeing PI data Carlo Szelinsky
2026-08-18 13:18 ` Kory Maincent [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=48761981-fd4d-4cd6-b4e3-cb575bb34349@bootlin.com \
--to=kory.maincent@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=github@szelinsky.de \
--cc=horms@kernel.org \
--cc=jelonek.jonas@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
/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