media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings
Subsystems (2)
PATCH 1/1 media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings
From: Hans de Goede <[email protected]>
[ 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.
[ Backport to 6.1.y: apply the sensor adev assignment in this tree's
older ipu3/cio2-bridge.c and cio2_bridge_connect_sensor(). ]
---
Hi Greg, Sasha, and IPU bridge maintainers,
I am continuing with CVE backports still missing from 6.1.y. This fix is inherited by v6.6 and every later mainline release, but 6.1.y still has the affected code. The target-specific adjustment is described in the bracketed note above.
Could you please queue it for 6.1.y?
Thanks,
Artem Dinaburg
CVE: CVE-2023-53336
Build: This patch was included in an x86_64 allmodconfig and CONFIG_WERROR=y build.
It produced vmlinux and modules with no new warnings or errors.
AI assistance: An LLM helped find, adapt, and validate this backport; I reviewed the patch and test output.
drivers/media/pci/intel/ipu3/cio2-bridge.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/pci/intel/ipu3/cio2-bridge.c +5 -0
@@ -280,6 +280,11 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, } sensor = &bridge->sensors[bridge->n_sensors]; +/* +* Borrow our adev ref to the sensor for now, on success +* acpi_dev_get(adev) is done further below. +*/ + sensor->adev = adev;strscpy (sensor->name, cfg->hid,sizeof (sensor->name)); ret = cio2_bridge_read_acpi_buffer(adev, "SSDB",
Signature · 1 line
2.39.5
Quoted 2 lines
[ Backport to 6.1.y: apply the sensor adev assignment in this tree's
olderipu3/cio2-bridge.candcio2_bridge_connect_sensor(). ]
Queued for 6.1, thanks.
Signature · 2 lines
Thanks, Sasha