The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alper Ak <alperyasinak1@gmail.com>
To: dan.scally@ideasonboard.com, jacopo.mondi@ideasonboard.com
Cc: Alper Ak <alperyasinak1@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Nayden Kanchev <nayden.kanchev@arm.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: mali-c55: Fix possible ERR_PTR dereference in mali_c55_isp_enable_streams()
Date: Sat, 27 Dec 2025 14:51:52 +0300	[thread overview]
Message-ID: <20251227115153.60862-1-alperyasinak1@gmail.com> (raw)

media_pad_remote_pad_unique() can return ERR_PTR(-ENOTUNIQ) or
ERR_PTR(-ENOLINK) on error situation.

The current code dereferences isp->remote_src without checking
for these error cases, which could lead to invalid memory access.

Add IS_ERR() check before dereferencing the pointer.

Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
 drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 4 ++++
 1 file changed, 4 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..ca1f0bde6f13 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
@@ -359,7 +359,11 @@ 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))
+		return PTR_ERR(isp->remote_src);
+
 	src_sd = media_entity_to_v4l2_subdev(isp->remote_src->entity);
 
 	isp->frame_sequence = 0;
-- 
2.43.0


             reply	other threads:[~2025-12-27 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 11:51 Alper Ak [this message]
2026-01-08 14:07 ` [PATCH] media: mali-c55: Fix possible ERR_PTR dereference in mali_c55_isp_enable_streams() Jacopo Mondi

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=20251227115153.60862-1-alperyasinak1@gmail.com \
    --to=alperyasinak1@gmail.com \
    --cc=dan.scally@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox