Commit 3e62aba8 authored by Marek Vasut's avatar Marek Vasut Committed by Mauro Carvalho Chehab
Browse files

media: imx-mipi-csis: Check csis_fmt validity before use



The find_csis_format() may return NULL in case supported format is not
found, check the return value of find_csis_format() before using the
result to avoid NULL pointer dereference.

Fixes: 11927d0f ("media: imx-mipi-csis: Use V4L2 subdev active state")
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 68e87ebf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1109,6 +1109,9 @@ static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
	csis_fmt = find_csis_format(fmt->code);
	v4l2_subdev_unlock_state(state);

	if (!csis_fmt)
		return -EPIPE;

	fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
	fd->num_entries = 1;