mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ma Ke <make24@iscas.ac.cn>
Cc: mchehab@kernel.org, ribalda@chromium.org,
	rafael.j.wysocki@intel.com, dongcheng.yan@intel.com,
	gregkh@linuxfoundation.org, peterz@infradead.org,
	wentong.wu@intel.com, sakari.ailus@linux.intel.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] media: pci: intel: Balance device refcount when destroying devices
Date: Tue, 15 Jul 2025 10:56:25 +0300	[thread overview]
Message-ID: <aHYJqbAgW2UX4TyB@smile.fi.intel.com> (raw)
In-Reply-To: <20250714132526.3216569-1-make24@iscas.ac.cn>

On Mon, Jul 14, 2025 at 09:25:26PM +0800, Ma Ke wrote:
> Using ipu_bridge_get_ivsc_csi_dev() to locate the device could cause
> an imbalance in the device's reference count.
> ipu_bridge_get_ivsc_csi_dev() calls device_find_child_by_name() to
> implement the localization, and device_find_child_by_name() calls an
> implicit get_device() to increment the device's reference count before
> returning the pointer. Throughout the entire implementation process,
> no mechanism releases resources properly. This leads to a memory leak
> because the reference count of the device is never decremented.
> 
> As the comment of device_find_child_by_name() says, 'NOTE: you will
> need to drop the reference with put_device() after use'.
> 
> Found by code review.

Okay, but have you check unregistering process? Does it have the put_device()
for this or not?

(The analysis is partial.)

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2025-07-15  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 13:25 Ma Ke
2025-07-15  7:56 ` 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=aHYJqbAgW2UX4TyB@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dongcheng.yan@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=mchehab@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=wentong.wu@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

all inboxes | Powered by JetHome®