media: ipu3-imgu: Fix NULL pointer dereference in active selection access
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 25 Aug 2022 18:36:37 +0000 (20:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Oct 2022 08:12:54 +0000 (10:12 +0200)
commit5265cc1202a31f7097691c3483a0d60d624424a5
treea7891e7d74dae860caf58ce6438e1d8390961d36
parent1e4e71f9e1970ea01c8b14b13794eb1e8bbc685f
media: ipu3-imgu: Fix NULL pointer dereference in active selection access

commit b9eb3ab6f30bf32f7326909f17949ccb11bab514 upstream.

What the IMGU driver did was that it first acquired the pointers to active
and try V4L2 subdev state, and only then figured out which one to use.

The problem with that approach and a later patch (see Fixes: tag) is that
as sd_state argument to v4l2_subdev_get_try_crop() et al is NULL, there is
now an attempt to dereference that.

Fix this.

Also rewrap lines a little.

Fixes: 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct")
Cc: stable@vger.kernel.org # for v5.14 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/ipu3/ipu3-v4l2.c