From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: "Andy Shevchenko" <andy@kernel.org>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Linus Walleij" <linusw@kernel.org>,
"Guenter Roeck" <linux@roeck-us.net>,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] platform/x86: intel_scu_wdt: fix reference leak on failed device registration
Date: Thu, 16 Apr 2026 11:03:34 +0300 [thread overview]
Message-ID: <aeCX1m_RMbSYXG8R@ashevche-desk.local> (raw)
In-Reply-To: <20260415180042.3648360-1-lgs201920130244@gmail.com>
On Thu, Apr 16, 2026 at 02:00:42AM +0800, Guangshuo Li wrote:
> When platform_device_register() fails in register_mid_wdt(), the
> embedded struct device in wdt_dev has already been initialized by
> device_initialize(), but the failure path returns the error without
> dropping the device reference for the current platform device:
>
> register_mid_wdt()
> -> platform_device_register(&wdt_dev)
> -> device_initialize(&wdt_dev.dev)
> -> setup_pdev_dma_masks(&wdt_dev)
> -> platform_device_add(&wdt_dev)
>
> This leads to a reference leak when platform_device_register() fails.
> Fix this by calling platform_device_put() before returning the error.
>
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-04-16 8:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 18:00 [PATCH] platform/x86: intel_scu_wdt: fix reference leak on failed device registration Guangshuo Li
2026-04-16 8:03 ` Andy Shevchenko [this message]
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=aeCX1m_RMbSYXG8R@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=lgs201920130244@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@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