public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Valery Borovsky <vebohr@gmail.com>, Ben Dooks <ben@fluff.org.uk>,
	Vincent Sanders <vince@arm.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] mfd: sm501: fix reference leak on failed device registration
Date: Tue, 5 May 2026 16:00:13 +0100	[thread overview]
Message-ID: <20260505150013.GC2661693@google.com> (raw)
In-Reply-To: <177790275684.156214.6563585281874262911.b4-ty@bootlin.com>

On Mon, 04 May 2026, Miquel Raynal wrote:

> On Mon, 04 May 2026 15:48:41 +0300, Valery Borovsky wrote:
> > When platform_device_register() fails in sm501_register_device(), the
> > platform device allocated by sm501_create_subdev() has its struct device
> > initialized by device_initialize() inside platform_device_register(). The
> > error path logs the error but returns without dropping the device reference,
> > leaking the memory allocated by sm501_create_subdev():
> > 
> >   sm501_register_device()
> >     -> platform_device_register(pdev)
> >        -> device_initialize(&pdev->dev)   /* kref = 1 */
> >        -> platform_device_add(pdev)       /* fails */
> >     <- dev_err() called, kref still 1, sm501_device_release never called
> > 
> > [...]
> 
> Applied to mtd/next, thanks!

I think you misread the subject line.

> [1/1] mfd: sm501: fix reference leak on failed device registration
>       commit: faa9bba3fe2f37e7dcb26d4501d890fbfd7df160
> 
> Patche(s) should be available on mtd/linux.git and will be
> part of the next PR (provided that no robot complains by then).

Please remove this from your tree.  It should be handled via M[F]D.

Thanks.

-- 
Lee Jones

  reply	other threads:[~2026-05-05 15:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 10:08 [PATCH 0/5] platform: fix reference leak on failed platform_device_register() Vastargazing
2026-05-04 10:08 ` [PATCH 1/5] misc: eeprom: digsy_mtc: fix reference leak on failed device registration Vastargazing
2026-05-04 10:08 ` [PATCH 2/5] platform/chrome: cros_ec_lpc: " Vastargazing
2026-05-05  2:40   ` Tzung-Bi Shih
2026-05-04 10:08 ` [PATCH 3/5] mtd: maps: physmap: " Vastargazing
2026-05-04 13:58   ` Miquel Raynal
2026-05-04 10:08 ` [PATCH 4/5] perf: arm: pmu: " Vastargazing
2026-05-05  8:50   ` Sudeep Holla
2026-05-04 10:08 ` [PATCH 5/5] mfd: sm501: " Vastargazing
2026-05-04 12:48   ` [PATCH v2] " Valery Borovsky
2026-05-04 13:52     ` Miquel Raynal
2026-05-05 15:00       ` Lee Jones [this message]
2026-05-05 15:12         ` Miquel Raynal
2026-05-05 10:36 ` [PATCH 1/5] perf/arm_pmu_acpi: fix reference leak in arm_pmu_acpi_probe error path Valery Borovsky

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=20260505150013.GC2661693@google.com \
    --to=lee@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ben@fluff.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=stable@vger.kernel.org \
    --cc=vebohr@gmail.com \
    --cc=vince@arm.linux.org.uk \
    /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