From: Chen Ni <nichen@iscas.ac.cn>
To: laurent.pinchart@ideasonboard.com, mchehab@kernel.org,
gregkh@linuxfoundation.org, sakari.ailus@linux.intel.com,
hverkuil-cisco@xs4all.nl
Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, Chen Ni <nichen@iscas.ac.cn>
Subject: [PATCH] staging: media: omap4iss: add check for media_pad_remote_pad_first
Date: Fri, 26 Jul 2024 15:28:14 +0800 [thread overview]
Message-ID: <20240726072814.3534601-1-nichen@iscas.ac.cn> (raw)
Add check for the return value of media_pad_remote_pad_first() and
return the error if it fails in order to avoid NULL pointer dereference.
Fixes: b2e44430b634 ("media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first()")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/staging/media/omap4iss/iss_csi2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index 0e6c5bd81930..43851bbd0cc3 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -539,6 +539,9 @@ static int csi2_configure(struct iss_csi2_device *csi2)
return -EBUSY;
pad = media_pad_remote_pad_first(&csi2->pads[CSI2_PAD_SINK]);
+ if (!pad)
+ return -EPIPE;
+
sensor = media_entity_to_v4l2_subdev(pad->entity);
pdata = sensor->host_priv;
--
2.25.1
next reply other threads:[~2024-07-26 7:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 7:28 Chen Ni [this message]
2024-07-26 7:48 ` [PATCH] staging: media: omap4iss: add check for media_pad_remote_pad_first Greg KH
2024-07-26 16:05 ` Dan Carpenter
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=20240726072814.3534601-1-nichen@iscas.ac.cn \
--to=nichen@iscas.ac.cn \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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