media: imx: imx-mipi-csis: Fix null pointer dereference when link is not set
PATCH 1/1 media: imx: imx-mipi-csis: Fix null pointer dereference when link is not set
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.
--- drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/nxp/imx-mipi-csis.c +3 -0
@@ -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,
Signature · 1 line
2.39.1
Hi Alexander,
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.
That would seem like an understatement.
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.
Quoted 20 lines
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/platform/nxp/imx-mipi-csis.c +3
-0@@ -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,
Signature · 3 lines
Regards, Sakari Ailus
Laurent Pinchart
maintainerQuoted 8 lines · Sakari Ailus
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.That would seem like an understatement.
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.
It's actually an issue in the pipeline validation code in the V4L2 core. The link is marked as MUST_CONNECT, but that isn't handled properly :-( It's been on my todo list for a while but I haven't had time to get to it. Feel free to give it a go.
Quoted 19 lines
Quoted 19 lines
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/platform/nxp/imx-mipi-csis.c +3
-0@@ -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,
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · Sakari Ailus
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.That would seem like an understatement.
Quoted 7 lines
Quoted 2 lines
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.It's actually an issue in the pipeline validation code in the V4L2 core. The link is marked as
MUST_CONNECT, but that isn't handled properly :-( It's been on my todo list for a while but I haven't had time to get to it. Feel free to give it a go.
What's wrong there? It used to work at least...
Signature · 1 line
Sakari Ailus
Laurent Pinchart
maintainerQuoted 11 lines · Sakari Ailus
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · Sakari Ailus
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.That would seem like an understatement.
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.
Quoted 6 lines
Quoted 4 lines
It's actually an issue in the pipeline validation code in the V4L2 core. The link is marked as
MUST_CONNECT, but that isn't handled properly :-( It's been on my todo list for a while but I haven't had time to get to it. Feel free to give it a go.What's wrong there? It used to work at least...
It's called a regression :-) If I recall correctly, if the pad is not connected, it's not added to the list of pads to check, and the MUST_CONNECT flag is not checked.
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 17 lines · Laurent Pinchart
Quoted 16 lines · Sakari Ailus
Quoted 14 lines · Laurent Pinchart
Quoted 8 lines · Sakari Ailus
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.That would seem like an understatement.
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.It's actually an issue in the pipeline validation code in the V4L2 core. The link is marked as
MUST_CONNECT, but that isn't handled properly :-( It's been on my todo list for a while but I haven't had time to get to it. Feel free to give it a go.
Quoted 5 lines
Quoted 1 line
What's wrong there? It used to work at least...
It's called a regression :-) If I recall correctly, if the pad is not connected, it's not added to the list of pads to check, and the
MUST_CONNECTflag is not checked.
This has potential for other similar issues in a number of drivers. I suppose this broke with the graph traversal changes ~ a year ago?
Signature · 1 line
Sakari Ailus
Laurent Pinchart
maintainerQuoted 18 lines · Sakari Ailus
Quoted 17 lines · Laurent Pinchart
Quoted 16 lines · Sakari Ailus
Quoted 14 lines · Laurent Pinchart
Quoted 8 lines · Sakari Ailus
Quoted 2 lines · Alexander Shiyan
Let's add a check for
src_sdbefore using it.
The link may not be set, in which case the call to this function will fail.That would seem like an understatement.
Any idea when this was introduced (and which patch did), Fixes: and Cc:
stable should be added if this is already in a release.It's actually an issue in the pipeline validation code in the V4L2 core. The link is marked as
MUST_CONNECT, but that isn't handled properly :-( It's been on my todo list for a while but I haven't had time to get to it. Feel free to give it a go.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
What's wrong there? It used to work at least...
It's called a regression :-) If I recall correctly, if the pad is not connected, it's not added to the list of pads to check, and the
MUST_CONNECTflag is not checked.This has potential for other similar issues in a number of drivers.
Indeed, which is why it should be fixed there.
Quoted 1 line
I suppose this broke with the graph traversal changes ~ a year ago?
I assume so, yes.
Signature · 3 lines
Regards, Laurent Pinchart