* [PATCH 1/2] drm/amd/display: Fix use-after-free in dm_test_vblank_control_worker_enable_increments
2026-12-05 0:49 [PATCH 0/2] drm/amd/display: Fix a couple of test failures John Harrison
@ 2026-12-05 0:49 ` John Harrison
2026-12-05 1:01 ` sashiko-bot
2026-12-05 0:49 ` [PATCH 2/2] drm/amd/display: Fix null pointer deref during dm_test_i2c_xfer_no_ddc_pin John Harrison
1 sibling, 1 reply; 4+ messages in thread
From: John Harrison @ 2026-12-05 0:49 UTC (permalink / raw)
To: amd-gfx; +Cc: dri-devel, kernel-dev
The test runs a worker thread and verifies that it did something.
However, the worker frees up the work item object that the 'did
something' check inspects.
The check is actually looking at data inside a different object (AMD
CRTC) but using the work item object to get there. So just save a
pointer to the desired CRTC object and use that in the test instead.
Signed-off-by: John Harrison <John.Harrison@Igalia.com>
---
.../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
index 88f4e9281c4e..fd6fde434ae0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
@@ -2019,14 +2019,16 @@ static void dm_test_vblank_control_worker_enable_increments(struct kunit *test)
{
struct vblank_control_work *work;
struct amdgpu_display_manager *dm;
+ struct amdgpu_crtc *acrtc;
work = dm_test_vblank_control_worker_setup(test, true, 0);
dm = work->dm;
+ acrtc = work->acrtc;
amdgpu_dm_crtc_vblank_control_worker(&work->work);
KUNIT_EXPECT_EQ(test, dm->active_vblank_irq_count, 1);
- KUNIT_EXPECT_TRUE(test, work->acrtc->dm_irq_params.vblank_irq_programmed);
+ KUNIT_EXPECT_TRUE(test, acrtc->dm_irq_params.vblank_irq_programmed);
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] drm/amd/display: Fix null pointer deref during dm_test_i2c_xfer_no_ddc_pin
2026-12-05 0:49 [PATCH 0/2] drm/amd/display: Fix a couple of test failures John Harrison
2026-12-05 0:49 ` [PATCH 1/2] drm/amd/display: Fix use-after-free in dm_test_vblank_control_worker_enable_increments John Harrison
@ 2026-12-05 0:49 ` John Harrison
1 sibling, 0 replies; 4+ messages in thread
From: John Harrison @ 2026-12-05 0:49 UTC (permalink / raw)
To: amd-gfx
Cc: dri-devel, kernel-dev, simonit.orig, Wayne Lin, Mario Limonciello,
Alex Deucher, Alex Hung, Bhawanpreet Lakha, Fangzhi Zuo,
George Zhang, Adrian Betschart, Alex Huang, Ivan Lipski,
Albert Esteve
The above selftest creates a mimimal I2C device which does not have
all the optional extras of a real hardware device. However, since the
patch below, the I2C code was assuming some of that state was present.
So add a check that 'ddc_service->link' is not null before trying to
dereference it.
Fixes: 8525c0e879da ("drm/amd/display: Route connector DDC over AUX for native DP sinks")
Cc: simonit.orig@gmail.com
Cc: Wayne Lin <Wayne.Lin@amd.com>
Cc: Mario Limonciello <superm1@kernel.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com>
Cc: Fangzhi Zuo <jerry.zuo@amd.com>
Cc: George Zhang <george.zhang@amd.com>
Cc: Adrian Betschart <adrian.betschart@cinemaone.ch>
Cc: Alex Huang <Alex.Huang2@amd.com>
Cc: Ivan Lipski <ivan.lipski@amd.com>
Cc: Albert Esteve <aesteve@redhat.com>
Signed-off-by: John Harrison <John.Harrison@Igalia.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index 85f00040c988..5f8b4ee582e7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -3445,7 +3445,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
if (!i2c->oem) {
struct dc_link *link = ddc_service->link;
- struct amdgpu_dm_connector *aconnector = link->priv;
+ struct amdgpu_dm_connector *aconnector = link ? link->priv : NULL;
/*
* DDC to a native DisplayPort sink is tunneled over the AUX
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread