From: Lee Jones <lee@kernel.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Thor Thayer <thor.thayer@linux.intel.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mfd: altera-sysmgr: Fix device reference leak in altr_sysmgr_regmap_lookup_by_phandle
Date: Thu, 6 Nov 2025 16:50:56 +0000 [thread overview]
Message-ID: <20251106165056.GB1949330@google.com> (raw)
In-Reply-To: <20251028041042.48874-1-linmq006@gmail.com>
On Tue, 28 Oct 2025, Miaoqian Lin wrote:
> driver_find_device_by_of_node() calls driver_find_device(), which calls
> get_device(). get_device() increments the device's reference count,
> so driver_find_device_by_of_node() returns a device
> with its reference count incremented.
> We need to release this reference after usage to avoid a reference leak.
>
> Add put_device(dev) after dev_get_drvdata() to fix the reference leak.
>
> Found via static analysis.
>
> Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Looks like Johan beat you to it.
--
Lee Jones [李琼斯]
prev parent reply other threads:[~2025-11-06 16:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 4:10 [PATCH] mfd: altera-sysmgr: Fix device reference leak in altr_sysmgr_regmap_lookup_by_phandle Miaoqian Lin
2025-11-06 16:50 ` Lee Jones [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=20251106165056.GB1949330@google.com \
--to=lee@kernel.org \
--cc=arnd@arndb.de \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thor.thayer@linux.intel.com \
/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