]> git.hungrycats.org Git - linux/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:31 +0000 (09:48 +0200)
commit3de35e29cfddfe6bff762b15bcfe8d80bebac6cb
treed574158325600f9f4a2c0c3b339421ba0d687831
parent91d790ac27eb2649c04cb42b5591bdccaccff0b3
media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings

[ Upstream commit 284be5693163343e1cf17c03917eecd1d6681bcf ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/pci/intel/ipu3/cio2-bridge.c