mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: "Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"André Draszik" <andre.draszik@linaro.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/8] regulator: core: Defer supply cleanup and unregister event forwarding on error
Date: Tue, 1 Dec 2026 11:02:09 +0000	[thread overview]
Message-ID: <20261201110209.GI90630@joneslee-mac.roam.internal> (raw)
In-Reply-To: <CAD=FV=VH3ZDiPkWDEgXcwJzFha_PFs6Od_Q1LyfvggiTBcSntg@mail.gmail.com>

On Mon, 30 Nov 2026, Doug Anderson wrote:

> Hi,
> 
> On Fri, Nov 27, 2026 at 10:36 AM Lee Jones <lee@kernel.org> wrote:
> >
> > When enabling rdev->supply fails in set_machine_constraints(), the error
> > path calls _regulator_put(rdev->supply) without holding
> > regulator_list_mutex and clears rdev->supply to NULL.  Neither
> > regulator_register() nor regulator_resolve_supply() holds
> > regulator_list_mutex here, and when called from
> > regulator_resolve_supply() under regulator_lock_dependent(), clearing
> > rdev->supply prevents regulator_unlock_dependent() from unlocking the
> > supply chain and skips unregister_regulator_event_forwarding().
> >
> > In addition, the wash error label in regulator_register() releases
> > rdev->supply and drops the device reference without calling
> > unregister_regulator_event_forwarding(), leaving a dangling notifier on
> > the supply chain after rdev is freed.
> 
> Are these two fixes somehow related to each other? As far as I can
> tell, these are two independent fixes and really shouldn't be in the
> same patch.
> 
> My AI seems to agree. It suggests:
> 
> > Splitting into two commits (first fixing wash: with Fixes: 433e294c3c5b, then fixing set_machine_constraints() with Fixes: 05f224ca6693 and Fixes: 8d38423d9dea) would let each fix target its relevant stable branches cleanly without introducing an intermediate regression.
> 
> I'll also note that as of 05f224ca6693, the code looked pretty
> different. I guess that commit still contained a bug, but the fix will
> look different from the fix on ToT.
> 
> 
> FWIW, my AI also noted a nit:
> 
> After removing the call in set_machine_constraints(), regulator_put()
> (:2696) is the sole remaining caller of _regulator_put() (:2665), so
> static void _regulator_put(struct regulator *regulator); at :118 is
> now unused. Fine to leave as-is to keep a stable fix minimal, or drop
> if doing a cleanup.

Thanks Doug (and Doug's AI) - will fix.

-- 
Lee Jones

  reply	other threads:[~2026-12-01 11:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 18:35 [PATCH 0/8] regulator: Fix locking, OOB read, lifetime, and global state bugs (batch 2) Lee Jones
2026-11-27 18:35 ` [PATCH 1/8] regulator: core: Defer supply cleanup and unregister event forwarding on error Lee Jones
2026-11-30 23:48   ` Doug Anderson
2026-12-01 11:02     ` Lee Jones [this message]
2026-11-27 18:35 ` [PATCH 2/8] regulator: max8907: Duplicate of_regulator_match table per device Lee Jones
2026-11-27 18:35 ` [PATCH 3/8] regulator: tps6594-regulator: Use dedicated handler for external regulator IRQs Lee Jones
2026-11-27 18:35 ` [PATCH 4/8] regulator: tps65910: Fix OOB read and bit shift in external sleep config Lee Jones
2026-11-27 18:35 ` [PATCH 5/8] regulator: tps6594-regulator: Bind IRQ resources to child platform device Lee Jones
2026-11-27 18:35 ` [PATCH 6/8] regulator: core: Respect is_locked when disabling supply on enable failure Lee Jones
2026-11-27 18:35 ` [PATCH 7/8] regulator: of: Guard against NULL device_node in of_regulator_bulk_get_all() Lee Jones
2026-11-27 18:35 ` [PATCH 8/8] regulator: aat2870: Duplicate regulator data per device Lee Jones

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=20261201110209.GI90630@joneslee-mac.roam.internal \
    --to=lee@kernel.org \
    --cc=andre.draszik@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®