linux/drivers/gpu/drm/tests
Maxime Ripard d0d7c93b4b drm/tests: shmem: Fix memleak
[ Upstream commit 48ccf21fa8 ]

The drm_gem_shmem_test_get_pages_sgt() gets a scatter-gather table using
the drm_gem_shmem_get_sg_table() function and rightfully calls
sg_free_table() on it. However, it's also supposed to kfree() the
returned sg_table, but doesn't.

This leads to a memory leak, reported by kmemleak. Fix it by adding a
kunit action to kfree the sgt when the test ends.

Reported-by: Philipp Stanner <phasta@mailbox.org>
Closes: https://lore.kernel.org/dri-devel/a7655158a6367ac46194d57f4b7433ef0772a73e.camel@mailbox.org/
Fixes: 93032ae634 ("drm/test: add a test suite for GEM objects backed by shmem")
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20250408140758.1831333-1-mripard@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-05-09 09:50:43 +02:00
..
.kunitconfig drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332() 2022-06-27 13:45:53 +02:00
drm_buddy_test.c drm-misc-next for 6.11: 2024-06-21 10:50:04 +10:00
drm_client_modeset_test.c drm/tests: modeset: Fix drm_display_mode memory leak 2025-04-20 10:15:07 +02:00
drm_cmdline_parser_test.c drm/tests: cmdline: Fix drm_display_mode memory leak 2025-04-20 10:15:07 +02:00
drm_connector_test.c drm/connector: hdmi: Fix memory leak in drm_display_mode_from_cea_vic() 2024-10-31 10:31:34 +01:00
drm_damage_helper_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_dp_mst_helper_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_exec_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_format_helper_test.c drm/format-helper: Pass format-conversion state to helpers 2023-11-14 10:16:53 +01:00
drm_format_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_framebuffer_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_gem_shmem_test.c drm/tests: shmem: Fix memleak 2025-05-09 09:50:43 +02:00
drm_hdmi_state_helper_test.c drm/tests: hdmi: Fix recursive locking 2025-03-22 12:54:18 -07:00
drm_kunit_edid.h drm/tests: Add HDMI connector bpc and format tests 2024-05-28 10:24:36 +02:00
drm_kunit_helpers.c drm/tests: helpers: Create kunit helper to destroy a drm_display_mode 2025-04-20 10:15:07 +02:00
drm_managed_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_mm_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_modes_test.c drm/tests: modes: Fix drm_display_mode memory leak 2025-04-20 10:15:07 +02:00
drm_plane_helper_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
drm_probe_helper_test.c drm/tests: probe-helper: Fix drm_display_mode memory leak 2025-04-20 10:15:07 +02:00
drm_rect_test.c drm/tests: add missing MODULE_DESCRIPTION() macros 2024-06-10 10:32:48 +02:00
Makefile drm/tests: Add output bpc tests 2024-05-28 10:09:38 +02:00