Re: [PATCH v14 1/4] phy: core: Fix use-after-free in phy_get paths
From: Loic Poulain
Date: Fri Sep 04 2026 - 08:49:31 EST
On Fri, Sep 4, 2026 at 11:41 AM Bryan O'Donoghue <bod@xxxxxxxxxx> wrote:
>
> On 04/09/2026 08:45, Loic Poulain wrote:
> >> - mutex_lock(&phy_provider_mutex);
> > Then, now we're moving the responsibility to the callers, maybe we should have:
> > lockdep_assert_held(&phy_provider_mutex)
>
> An LLM suggested the same thing to me but, I thought the resulting patch
> "looked messy".
>
> Do you want it added, its only three additional callsites.
It's only a minor suggestion, but if you end up submitting a new
version, it might be worth including.
I would also probably use a scoped/guarded locking pattern for the
mutex, as it tends to simplify the error paths. That said, it's mostly
a matter of personal preference, and some maintainers prefer explicit
lock/unlock pairs for clarity.
Regards,
Loic