public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Vinod Koul <vkoul@kernel.org>,
	 Kishon Vijay Abraham I <kishon@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	 "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	 Johan Hovold <johan+linaro@kernel.org>,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
	 "Dr. David Alan Gilbert" <linux@treblig.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	 Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	 Zijun Hu <zijun.hu@oss.qualcomm.com>,
	linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: core: fix potential UAF in of_phy_simple_xlate()
Date: Fri, 20 Feb 2026 17:01:50 -0800	[thread overview]
Message-ID: <aZkCyQ1oizPXplyU@google.com> (raw)
In-Reply-To: <aZemjhBNFyOfKeNL@google.com>

On Thu, Feb 19, 2026 at 04:11:37PM -0800, Dmitry Torokhov wrote:
> On Thu, Feb 19, 2026 at 03:57:11PM -0800, Dmitry Torokhov wrote:
> > The implementation put_device()s located device and then uses
> > container_of() on the pointer. The device may disappear by that time,
> > resulting in UAF.
> > 
> > Fix the problem by keeping the reference to the framer device,
> > avoiding getting an extra reference to it in framer_get(), and making
> > sure to drop the reference in error path when we fail to get the module.
> 
> Hmm, I was too rash. There are bunch of other xlate functions that need
> to be updated to take the reference.

So I am convinced that xlate functions need to bump up the reference to
phy devices they return. The question is how to deal with the ones that
do not. I can either convert them in the same patch (the changes are
quite mechanical) or we can do the whole song and dance, introduce a
flag, set it up in converted xlate functions, have the core respect it,
and then remove it from xlates and from the core when it is all done.

Please let me know.

Thanks.

-- 
Dmitry

  reply	other threads:[~2026-02-21  1:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 23:57 [PATCH] phy: core: fix potential UAF in of_phy_simple_xlate() Dmitry Torokhov
2026-02-20  0:11 ` Dmitry Torokhov
2026-02-21  1:01   ` Dmitry Torokhov [this message]
2026-02-23 23:15     ` Vladimir Oltean
2026-02-24  0:37       ` Dmitry Torokhov
2026-02-24 15:47         ` Vladimir Oltean
2026-02-24 20:38           ` Dmitry Torokhov
2026-02-25 23:50             ` Vladimir Oltean
2026-02-28  3:44 ` Zijun Hu

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=aZkCyQ1oizPXplyU@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=geert+renesas@glider.be \
    --cc=johan+linaro@kernel.org \
    --cc=kishon@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux@treblig.org \
    --cc=neil.armstrong@linaro.org \
    --cc=peter.griffin@linaro.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=vkoul@kernel.org \
    --cc=zijun.hu@oss.qualcomm.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