From: jsg Date: Thu, 30 Nov 2023 02:57:53 +0000 (+0000) Subject: drm/amd/display: fix a NULL pointer dereference in amdgpu_dm_i2c_xfer() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=150d74e7b8a3895b79e1cb7c95d258d833ee2ca3;p=openbsd 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 --- 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)