mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Alper Ak <alperyasinak1@gmail.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
	Daniel Scally <dan.scally+renesas@ideasonboard.com>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: rzg2l-cru: Fix possible ERR_PTR deference
Date: Sat, 7 Feb 2026 23:27:23 +0200	[thread overview]
Message-ID: <20260207212723.GN1376807@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260207094841.603932-1-alperyasinak1@gmail.com>

On Sat, Feb 07, 2026 at 12:48:39PM +0300, Alper Ak wrote:
> The media_pad_remote_pad_unique() can return ERR_PTR() on failure
> (-ENOTUNIQ or -ENOLINK), but the code was dereferencing the return
> value without checking for errors. Add IS_ERR() check before
> dereferencing the pointer.

Have you seen this happening ?

> Fixes: d7d72dae81d5 ("media: rzg2l-cru: Retrieve virtual channel information")
> Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
> ---
>  drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 162e2ace6931..a34c2188df1a 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -411,6 +411,12 @@ static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru)
>  	int ret;
>  
>  	remote_pad = media_pad_remote_pad_unique(&cru->ip.pads[RZG2L_CRU_IP_SINK]);
> +	if (IS_ERR(remote_pad)) {
> +		ret = PTR_ERR(remote_pad);
> +		dev_err(cru->dev, "Failed to get remote source pad: %d\n", ret);
> +		return ret;
> +	}
> +
>  	ret = v4l2_subdev_call(cru->ip.remote, pad, get_frame_desc, remote_pad->index, &fd);
>  	if (ret < 0 && ret != -ENOIOCTLCMD) {
>  		dev_err(cru->dev, "get_frame_desc failed on IP remote subdev\n");

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-02-07 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-07  9:48 Alper Ak
2026-02-07 21:27 ` Laurent Pinchart [this message]
2026-02-08 11:07   ` Alper Ak
2026-02-08 13:49     ` Laurent Pinchart
2026-02-14 15:03     ` Markus Elfring

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=20260207212723.GN1376807@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alperyasinak1@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dan.scally+renesas@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=tommaso.merciai.xr@bp.renesas.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®