diff mbox series

media: atmel-isi: Fix crash due to missing subdev in state

Message ID 20231208120637.7155-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 1545c2b92bdf408e860dea2cf958b65e17a0ce18
Headers show
Series media: atmel-isi: Fix crash due to missing subdev in state | expand

Commit Message

Laurent Pinchart Dec. 8, 2023, 12:06 p.m. UTC
As a result of converting to the stream-aware state functions, commit
bc0e8d91feec ("media: v4l: subdev: Switch to stream-aware state
functions") caused the sd pointer of the state passed to the
v4l2_subdev_state_get_crop() function to be dereferenced. It however
missed that the atmel-isi driver creates the v4l2_subdev_state instance
on the stack (which it shouldn't do, but that's a separate problem),
without initializing the sd field. This results in a null pointer
dereference.

Fix it by initializing the sd field.

Fixes: bc0e8d91feec ("media: v4l: subdev: Switch to stream-aware state functions")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
This fixes a regression in the media_stage/master branch, scheduled for
merge in v6.8. It should be applied before the opening of the next merge
window.
---
 drivers/media/platform/atmel/atmel-isi.c | 1 +
 1 file changed, 1 insertion(+)


base-commit: bec3db03911bd85da29c1c8ee556162153002c9a
diff mbox series

Patch

diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
index da58f33b6b0a..ed70c030858d 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -589,6 +589,7 @@  static int isi_try_fmt(struct atmel_isi *isi, struct v4l2_format *f,
 	struct v4l2_pix_format *pixfmt = &f->fmt.pix;
 	struct v4l2_subdev_pad_config pad_cfg = {};
 	struct v4l2_subdev_state pad_state = {
+		.sd = isi->entity.subdev,
 		.pads = &pad_cfg,
 	};
 	struct v4l2_subdev_format format = {