Re: [PATCH] media: imx: imx-mipi-csis: Fix null pointer dereference when link is not set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexander,

On Fri, Oct 06, 2023 at 10:46:54AM +0300, Alexander Shiyan wrote:
> 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.

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.

> 
> Signed-off-by: Alexander Shiyan <eagle.alexander923@xxxxxxxxx>
> ---
>  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,

-- 
Regards,

Sakari Ailus



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux