On Sat Feb 7 12:18:22 2026 +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.
>
> Cc: [email protected]
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Signed-off-by: Alper Ak <[email protected]>
> Reviewed-by: Jacopo Mondi <[email protected]>
> Reviewed-by: Daniel Scally <[email protected]>
> Signed-off-by: Jacopo Mondi <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
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 dfa5dbe68c46..e128adf6ee37 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
@@ -333,6 +333,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;
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]