media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings
authorHans de Goede <hdegoede@redhat.com>
Wed, 5 Jul 2023 21:29:53 +0000 (23:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:58:40 +0000 (07:58 +0200)
commit284be5693163343e1cf17c03917eecd1d6681bcf
tree552e0aefd08fa0ae5cdb1157445ce8529fe3fd93
parentceee7fb05bad66d3ae295664beb348673681e498
media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings

When ipu_bridge_parse_rotation() and ipu_bridge_parse_orientation() run
sensor->adev is not set yet.

So if either of the dev_warn() calls about unknown values are hit this
will lead to a NULL pointer deref.

Set sensor->adev earlier, with a borrowed ref to avoid making unrolling
on errors harder, to fix this.

Fixes: 485aa3df0dff ("media: ipu3-cio2: Parse sensor orientation and rotation")
Cc: Fabian Wüthrich <me@fabwu.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/pci/intel/ipu-bridge.c