From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: linux-media@vger.kernel.org
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Martin Kepplinger <martink@posteo.de>,
Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH] media: imx: imx-mipi-csis: Fix null pointer dereference when link is not set
Date: Fri, 6 Oct 2023 10:46:54 +0300 [thread overview]
Message-ID: <20231006074654.11468-1-eagle.alexander923@gmail.com> (raw)
Let's add a check for src_sd before using it.
The link may not be set, in which case the call to this function will fail.
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index 5f93712bf485..df5a159b2d39 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -595,6 +595,9 @@ static int mipi_csis_calculate_params(struct mipi_csis_device *csis,
s64 link_freq;
u32 lane_rate;
+ if (!csis->src_sd)
+ return -EINVAL;
+
/* Calculate the line rate from the pixel rate. */
link_freq = v4l2_get_link_freq(csis->src_sd->ctrl_handler,
csis_fmt->width,
--
2.39.1
next reply other threads:[~2023-10-06 7:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 7:46 Alexander Shiyan [this message]
2023-10-11 19:44 ` [PATCH] media: imx: imx-mipi-csis: Fix null pointer dereference when link is not set Sakari Ailus
2023-10-11 19:48 ` Laurent Pinchart
2023-10-11 20:01 ` Sakari Ailus
2023-10-11 20:06 ` Laurent Pinchart
2023-10-11 20:19 ` Sakari Ailus
2023-10-11 20:21 ` Laurent Pinchart
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=20231006074654.11468-1-eagle.alexander923@gmail.com \
--to=eagle.alexander923@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=rmfrfs@gmail.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