Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Xiaolei Wang <xiaolei.wang@windriver.com>
Cc: mchehab@kernel.org, Frank.li@nxp.com, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com,
	jacopo@jmondi.org, guoniu.zhou@nxp.com, s.riedmueller@phytec.de,
	linux-media@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 3/4] media: nxp: imx8-isi: Fix missing v4l2_subdev_cleanup() in pipe init error path
Date: Thu, 7 May 2026 11:37:17 +0300	[thread overview]
Message-ID: <20260507083717.GH1778786@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260507041318.491594-4-xiaolei.wang@windriver.com>

On Thu, May 07, 2026 at 12:13:17PM +0800, Xiaolei Wang wrote:
> After v4l2_subdev_init_finalize() succeeds in mxc_isi_pipe_init(), if
> platform_get_irq() or devm_request_irq() fails, the error path jumps to
> a label that only calls media_entity_cleanup() and mutex_destroy(),
> missing the v4l2_subdev_cleanup() call needed to free the subdev active
> state allocated by v4l2_subdev_init_finalize().
> 
> Add an error_subdev label that calls v4l2_subdev_cleanup() before
> falling through to the existing error cleanup.
> 
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> index cb50af2270f6..a59b9456b590 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> @@ -796,18 +796,20 @@ int mxc_isi_pipe_init(struct mxc_isi_dev *isi, unsigned int id)
>  	irq = platform_get_irq(to_platform_device(isi->dev), id);
>  	if (irq < 0) {
>  		ret = irq;
> -		goto error;
> +		goto error_subdev;
>  	}
>  
>  	ret = devm_request_irq(isi->dev, irq, mxc_isi_pipe_irq_handler,
>  			       0, dev_name(isi->dev), pipe);
>  	if (ret < 0) {
>  		dev_err(isi->dev, "failed to request IRQ (%d)\n", ret);
> -		goto error;
> +		goto error_subdev;
>  	}
>  
>  	return 0;
>  
> +error_subdev:
> +	v4l2_subdev_cleanup(sd);
>  error:
>  	media_entity_cleanup(&sd->entity);
>  	mutex_destroy(&pipe->lock);

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2026-05-07  8:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  4:13 [PATCH v3 0/4] media: imx8-isi: fix resource cleanup issues Xiaolei Wang
2026-05-07  4:13 ` [PATCH v3 1/4] media: imx8-isi: fix use-after-free on remove Xiaolei Wang
2026-05-07  4:13 ` [PATCH v3 2/4] media: imx8-isi: add missing v4l2_subdev_cleanup() in crossbar and pipe Xiaolei Wang
2026-05-07  4:13 ` [PATCH v3 3/4] media: nxp: imx8-isi: Fix missing v4l2_subdev_cleanup() in pipe init error path Xiaolei Wang
2026-05-07  8:37   ` Laurent Pinchart [this message]
2026-05-07  4:13 ` [PATCH v3 4/4] media: imx8-isi: clean up already-initialized pipes on probe failure Xiaolei Wang

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=20260507083717.GH1778786@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Frank.li@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=festevam@gmail.com \
    --cc=guoniu.zhou@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.riedmueller@phytec.de \
    --cc=stable@vger.kernel.org \
    --cc=xiaolei.wang@windriver.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