public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Lee Jones <lee@kernel.org>
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, 05 May 2026 17:12:11 +0200	[thread overview]
Message-ID: <87pl39oppw.fsf@bootlin.com> (raw)
In-Reply-To: <20260505150013.GC2661693@google.com> (Lee Jones's message of "Tue, 5 May 2026 16:00:13 +0100")

Hi Lee,

On 05/05/2026 at 16:00:13 +01, Lee Jones <lee@kernel.org> wrote:

> 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.

Yes, it took a bit of time for me to receive my own answer so I replied
to the original patch immediately stating that I dropped it. For some
reason b4 applied this patch, whereas I was applying another m*t*d patch
from apparently the same series (?). Both the contribution and b4 behaviour
was strange.

Sorry for the noise.

Thanks,
Miquèl

  reply	other threads:[~2026-05-05 15:12 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
2026-05-05 15:12         ` Miquel Raynal [this message]
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=87pl39oppw.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben@fluff.org.uk \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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