]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/vc4: tests: Stop allocating the state in test init
authorMaxime Ripard <mripard@kernel.org>
Thu, 3 Apr 2025 13:33:32 +0000 (15:33 +0200)
committerMaxime Ripard <mripard@kernel.org>
Mon, 7 Apr 2025 08:29:44 +0000 (10:29 +0200)
commit7e0351ae91ed2b6178abbfae96c3c6aaa1652567
tree8d6f4e13113d07861cb63f1ec2e129604bfb2fcb
parent321e644716a3dd517cfa0a035deb3a2a0209f0db
drm/vc4: tests: Stop allocating the state in test init

The vc4-pv-muxing-combinations and vc5-pv-muxing-combinations test
suites use a common test init function which, in part, allocates the
drm atomic state the test will use.

That allocation relies on  drm_kunit_helper_atomic_state_alloc(), and
thus requires a struct drm_modeset_acquire_ctx. This context will then
be stored in the allocated state->acquire_ctx field.

However, the context is local to the test init function, and is cleared
as soon as drm_kunit_helper_atomic_state_alloc() is done. We thus end up
with an dangling pointer to a cleared context in state->acquire_ctx for
our test to consumes.

We should really allocate the context and the state in the test
functions, so we can also control when we're done with it.

Fixes: 30188df0c387 ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")
Reviewed-by: MaĆ­ra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20250403-drm-vc4-kunit-failures-v2-3-e09195cc8840@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c