From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: Alper Ak <alperyasinak1@gmail.com>
Cc: Daniel Scally <dan.scally@ideasonboard.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Nayden Kanchev <nayden.kanchev@arm.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: malic55: Fix possible ERR_PTR deference in enable_streams
Date: Mon, 9 Feb 2026 09:49:08 +0100 [thread overview]
Message-ID: <aYme0vuJtoBI591u@zed> (raw)
In-Reply-To: <20260207091822.601255-1-alperyasinak1@gmail.com>
Hi Alper
On Sat, Feb 07, 2026 at 12:18:22PM +0300, Alper Ak wrote:
> The media_pad_remote_pad_unique() function returns either a valid
> pointer or an ERR_PTR() on failure (-ENOTUNIQ if multiple links are
> enabled, -ENOLINK if no connected pad is found). The return value
> was assigned directly to isp->remote_src and dereferenced in the
> next line without checking for errors, which could lead to an
> ERR_PTR dereference.
>
> Add proper error checking with IS_ERR() before dereferencing the
> pointer. Also set isp->remote_src to NULL on error to maintain
> consistency with other error paths in the function.
>
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
As the media link on the ISP sink pad #0 can connect to either the TPG
entity or to the [CSI-2 RX | IVC] pair, it is created without an
IMMUTABLE flag and can be in facts disabled.
So I guess the check is correct in this case:
Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
As per the other patch for the CRU, it might be nice to attribute
credit to the static analysis tool you have used.
> ---
> drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> index 497f25fbdd13..c7225e9c8df7 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> @@ -360,6 +360,13 @@ static int mali_c55_isp_enable_streams(struct v4l2_subdev *sd,
>
> sink_pad = &isp->pads[MALI_C55_ISP_PAD_SINK_VIDEO];
> isp->remote_src = media_pad_remote_pad_unique(sink_pad);
> + if (IS_ERR(isp->remote_src)) {
> + ret = PTR_ERR(isp->remote_src);
> + dev_err(mali_c55->dev, "Failed to get remote source pad: %d\n", ret);
> + isp->remote_src = NULL;
> + return ret;
> + }
> +
> src_sd = media_entity_to_v4l2_subdev(isp->remote_src->entity);
>
> isp->frame_sequence = 0;
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-09 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 9:18 [PATCH] media: malic55: Fix possible ERR_PTR deference in enable_streams Alper Ak
2026-02-09 8:49 ` Jacopo Mondi [this message]
2026-02-09 11:40 ` Dan Scally
2026-02-14 14:36 ` Markus Elfring
2026-03-06 6:31 ` Alper Ak
2026-03-06 6:46 ` Markus Elfring
2026-03-06 8:56 ` [PATCH] " Jacopo Mondi
2026-03-06 9:06 ` 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=aYme0vuJtoBI591u@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=alperyasinak1@gmail.com \
--cc=dan.scally@ideasonboard.com \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nayden.kanchev@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.