linux-stable/drivers/staging/media
Maximilian Luz 611d617bdb 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>
2023-01-07 11:15:55 +01:00
..
atomisp media: atomisp: prevent integer overflow in sh_css_set_black_frame() 2022-11-04 00:00:25 +09:00
av7110 media: av7110: Remove duplicate 'with' in two places. 2022-06-27 09:31:18 +01:00
hantro media: hantro: HEVC: Fix chroma offset computation 2022-11-10 18:17:24 +01:00
imx media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formats 2022-12-31 13:26:02 +01:00
ipu3 ipu3-imgu: Fix NULL pointer dereference in imgu_subdev_set_selection() 2023-01-07 11:15:55 +01:00
max96712 media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
meson/vdec media: meson: vdec: fix possible refcount leak in vdec_probe() 2022-11-10 18:17:24 +01:00
omap4iss media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first() 2022-07-17 11:21:35 +01:00
rkvdec media: rkvdec: Add required padding 2022-12-31 13:25:55 +01:00
stkwebcam media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependencies 2022-12-31 13:26:11 +01:00
sunxi media: cedrus: hevc: Fix offset adjustments 2022-12-31 13:25:51 +01:00
tegra-video staging: media: tegra-video: fix device_node use after free 2023-01-07 11:15:52 +01:00
zoran media: staging: media: zoran: replace dprintk with new debugging macros 2022-06-20 10:30:29 +01:00
Kconfig media: stkwebcam: deprecate driver, move to staging 2022-06-20 10:30:31 +01:00
Makefile media: stkwebcam: deprecate driver, move to staging 2022-06-20 10:30:31 +01:00