Linux IIO development
 help / color / mirror / Atom feed
From: William Breathitt Gray <wbg@kernel.org>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Guangshuo Li" <lgs201920130244@gmail.com>
Cc: William Breathitt Gray <wbg@kernel.org>, stable@vger.kernel.org
Subject: Re: [PATCH v2] counter: Fix refcount leak in counter_alloc() error path
Date: Sun,  3 May 2026 13:55:06 +0900	[thread overview]
Message-ID: <177778406130.426389.16825154395288414003.b4-ty@kernel.org> (raw)
In-Reply-To: <20260413134604.2861772-1-lgs201920130244@gmail.com>


On Mon, 13 Apr 2026 21:46:04 +0800, Guangshuo Li wrote:
> After device_initialize(), the lifetime of the embedded struct device
> is expected to be managed through the device core reference counting.
> 
> In counter_alloc(), if dev_set_name() fails after device_initialize(),
> the error path removes the chrdev, frees the ID, and frees the backing
> allocation directly instead of releasing the device reference with
> put_device(). This bypasses the normal device lifetime rules and may
> leave the reference count of the embedded struct device unbalanced,
> resulting in a refcount leak.
> 
> [...]

Applied, thanks!

[1/1] counter: Fix refcount leak in counter_alloc() error path
      commit: d9eeb0ea0d2de658663bfaa9c26eccdd8fd64440

Best regards,
-- 
William Breathitt Gray <wbg@kernel.org>

      reply	other threads:[~2026-05-03  4:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 13:46 [PATCH v2] counter: Fix refcount leak in counter_alloc() error path Guangshuo Li
2026-05-03  4:55 ` William Breathitt Gray [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=177778406130.426389.16825154395288414003.b4-ty@kernel.org \
    --to=wbg@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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