]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/i915/selftests: Change mock_request() to return error pointers
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 25 Jun 2025 15:21:58 +0000 (10:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:25:00 +0000 (18:25 +0200)
commit6d2d741052a4740d12c7d0c4040f3d6a500b5f97
treee695e422c9ac44c8b41b2bfe807754877e181dd0
parentfb6c27aaf315d35b9fb83a1be24253d2c5d7b39b
drm/i915/selftests: Change mock_request() to return error pointers

[ Upstream commit caa7c7a76b78ce41d347003f84975125383e6b59 ]

There was an error pointer vs NULL bug in __igt_breadcrumbs_smoketest().
The __mock_request_alloc() function implements the
smoketest->request_alloc() function pointer.  It was supposed to return
error pointers, but it propogates the NULL return from mock_request()
so in the event of a failure, it would lead to a NULL pointer
dereference.

To fix this, change the mock_request() function to return error pointers
and update all the callers to expect that.

Fixes: 52c0fdb25c7c ("drm/i915: Replace global breadcrumbs with per-context interrupt tracking")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/685c1417.050a0220.696f5.5c05@mx.google.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 778fa8ad5f0f23397d045c7ebca048ce8def1c43)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/i915/selftests/i915_request.c
drivers/gpu/drm/i915/selftests/mock_request.c