Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Ma Ke <make24@iscas.ac.cn>
Cc: bingbu.cao@intel.com, lixu.zhang@intel.com,
	stanislaw.gruszka@linux.intel.com, mchehab@kernel.org,
	wentong.wu@intel.com, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] media: pci: intel: ivsc: fix error handling in mei_ace driver
Date: Mon, 22 Sep 2025 13:44:01 +0300	[thread overview]
Message-ID: <aNEocYyaT2pig7So@kekkonen.localdomain> (raw)
In-Reply-To: <20250922094335.28486-1-make24@iscas.ac.cn>

Hi Ma,

On Mon, Sep 22, 2025 at 05:43:35PM +0800, Ma Ke wrote:
> The mei_ace driver contains a device reference count leak in
> mei_ace_setup_dev_link() where device_find_child_by_name() increases
> the reference count of the found device but this reference is not
> properly decreased in the success path. Add put_device() in
> mei_ace_setup_dev_link() and delete put_device() in mei_ace_remove(),
> which ensures that the reference count of the device is correctly
> managed regardless of whether the probe is successful or fails.
> 
> Found by code review.
> 
> Cc: stable@vger.kernel.org
> Fixes: 78876f71b3e9 ("media: pci: intel: ivsc: Add ACE submodule")

As this isn't a bug fix, I don't think we need these two tags. This should
be taken into account in the subject and commit message as well.

> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
> Changes in v2:
> - modified the put_device() operations and the patch title as suggestions.
> ---
>  drivers/media/pci/intel/ivsc/mei_ace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/intel/ivsc/mei_ace.c b/drivers/media/pci/intel/ivsc/mei_ace.c
> index 98310b8511b1..bb57656fc85a 100644
> --- a/drivers/media/pci/intel/ivsc/mei_ace.c
> +++ b/drivers/media/pci/intel/ivsc/mei_ace.c
> @@ -420,6 +420,7 @@ static int mei_ace_setup_dev_link(struct mei_ace *ace)
>  		goto err_put;
>  	}
>  
> +	put_device(csi_dev);

You can do this right after calling device_link_add().

>  	ace->csi_dev = csi_dev;
>  
>  	return 0;
> @@ -522,7 +523,6 @@ static void mei_ace_remove(struct mei_cl_device *cldev)
>  	cancel_work_sync(&ace->work);
>  
>  	device_link_del(ace->csi_link);
> -	put_device(ace->csi_dev);
>  
>  	pm_runtime_disable(&cldev->dev);
>  	pm_runtime_set_suspended(&cldev->dev);

-- 
Regards,

Sakari Ailus

      reply	other threads:[~2025-09-22 10:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  9:43 [PATCH v2] media: pci: intel: ivsc: fix error handling in mei_ace driver Ma Ke
2025-09-22 10:44 ` Sakari Ailus [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=aNEocYyaT2pig7So@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bingbu.cao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lixu.zhang@intel.com \
    --cc=make24@iscas.ac.cn \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stanislaw.gruszka@linux.intel.com \
    --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