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)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 07:04:32 +0000 (09:04 +0200)
commitb9eb3ab6f30bf32f7326909f17949ccb11bab514
treef76f3c69df3ffbad49e63726011a3676815bdd3d
parent8fcccd2f37b27503694c6cd82a6c5ab911e69d73
media: ipu3-imgu: Fix NULL pointer dereference in active selection access

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>
drivers/staging/media/ipu3/ipu3-v4l2.c