mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Walleij <linusw@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] eeprom: digsy_mtc: fix reference leak on failed device registration
Date: Thu, 16 Apr 2026 10:52:26 +0300	[thread overview]
Message-ID: <aeCVOuLGrcm0L5rP@ashevche-desk.local> (raw)
In-Reply-To: <20260415165203.3584869-1-lgs201920130244@gmail.com>

On Thu, Apr 16, 2026 at 12:52:02AM +0800, Guangshuo Li wrote:
> When platform_device_register() fails in digsy_mtc_eeprom_devices_init(),
> the embedded struct device in digsy_mtc_eeprom has already been
> initialized by device_initialize(), but the failure path only removes
> the software node and does not drop the device reference for the current
> platform device:
> 
>   digsy_mtc_eeprom_devices_init()
>     -> platform_device_register(&digsy_mtc_eeprom)
>        -> device_initialize(&digsy_mtc_eeprom.dev)
>        -> setup_pdev_dma_masks(&digsy_mtc_eeprom)
>        -> platform_device_add(&digsy_mtc_eeprom)
> 
> This leads to a reference leak when platform_device_register() fails.
> Fix this by calling platform_device_put() after removing the software
> node.
> 
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review.

Thanks for catching this up!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-04-16  7:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 16:52 Guangshuo Li
2026-04-16  7:52 ` Andy Shevchenko [this message]
2026-04-24  8:21   ` Guangshuo Li
2026-04-24  8:36     ` Andy Shevchenko

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=aeCVOuLGrcm0L5rP@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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®