summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-11-30 02:57:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-11-30 02:57:54 +0000
commit058206f7d1ca327a9f61dad57b64fa61c818ae8e (patch)
tree5dcfcb4f7aaf8bedb6c8d0ab1300a9aa845903d7 /sys
parentd55f2269a773080fd4b3e5e10e929e62051f258d (diff)
drm/amd/display: fix a NULL pointer dereference in amdgpu_dm_i2c_xfer()
From Mario Limonciello fb5c134ca589fe670430acc9e7ebf2691ca2476d in linux-6.1.y/6.1.64 b71f4ade1b8900d30c661d6c27f87c35214c398c in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 64a9b954d92..09815d3d365 100644
--- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7221,6 +7221,9 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
int i;
int result = -EIO;
+ if (!ddc_service->ddc_pin || !ddc_service->ddc_pin->hw_info.hw_supported)
+ return result;
+
cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL);
if (!cmd.payloads)