linux/drivers/staging/media
Maximilian Luz 5038ee6776 ipu3-imgu: Fix NULL pointer dereference in imgu_subdev_set_selection()
commit dc608edf7d upstream.

Calling v4l2_subdev_get_try_crop() and v4l2_subdev_get_try_compose()
with a subdev state of NULL leads to a NULL pointer dereference. This
can currently happen in imgu_subdev_set_selection() when the state
passed in is NULL, as this method first gets pointers to both the "try"
and "active" states and only then decides which to use.

The same issue has been addressed for imgu_subdev_get_selection() with
commit 30d03a0de650 ("ipu3-imgu: Fix NULL pointer dereference in active
selection access"). However the issue still persists in
imgu_subdev_set_selection().

Therefore, apply a similar fix as done in the aforementioned commit to
imgu_subdev_set_selection(). To keep things a bit cleaner, introduce
helper functions for "crop" and "compose" access and use them in both
imgu_subdev_set_selection() and imgu_subdev_get_selection().

Fixes: 0d346d2a6f ("media: v4l2-subdev: add subdev-wide state struct")
Cc: stable@vger.kernel.org # for v5.14 and later
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2023-01-07 11:11:51 +01:00
..
atomisp media fixes for v6.1-rc2 2022-10-22 15:30:15 -07:00
deprecated media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependencies 2022-12-31 13:32:25 +01:00
imx media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formats 2022-12-31 13:32:16 +01:00
ipu3 ipu3-imgu: Fix NULL pointer dereference in imgu_subdev_set_selection() 2023-01-07 11:11:51 +01:00
max96712 i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
meson/vdec media: meson: vdec: fix possible refcount leak in vdec_probe() 2022-09-24 08:55:43 +02:00
omap4iss media: drivers: use video device pipeline start/stop 2022-09-24 09:14:20 +02:00
rkvdec media: rkvdec: Add required padding 2022-12-31 13:32:08 +01:00
sunxi media: cedrus: hevc: Fix offset adjustments 2022-12-31 13:32:04 +01:00
tegra-video staging: media: tegra-video: fix device_node use after free 2023-01-07 11:11:49 +01:00
Kconfig media: destage Hantro VPU driver 2022-08-31 10:23:50 +02:00
Makefile media: destage Hantro VPU driver 2022-08-31 10:23:50 +02:00