Skip to content

Commit 788568f

Browse files
drm/i915/guc: Fix potential null pointer deref in GuC 'steal id' test
It was noticed that if the very first 'stealing' request failed to create for some reason then the 'steal all ids' loop would immediately exit with 'last' still being NULL. The test would attempt to continue but using a null pointer. Fix that by aborting the test if it fails to create any requests at all. Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230802184940.911753-1-John.C.Harrison@Intel.com
1 parent f1530f9 commit 788568f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/i915/gt/uc/selftest_guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ static int intel_guc_steal_guc_ids(void *arg)
204204
if (IS_ERR(rq)) {
205205
ret = PTR_ERR(rq);
206206
rq = NULL;
207-
if (ret != -EAGAIN) {
208-
guc_err(guc, "Failed to create request %d: %pe\n",
209-
context_index, ERR_PTR(ret));
207+
if ((ret != -EAGAIN) || !last) {
208+
guc_err(guc, "Failed to create %srequest %d: %pe\n",
209+
last ? "" : "first ", context_index, ERR_PTR(ret));
210210
goto err_spin_rq;
211211
}
212212
} else {

0 commit comments

Comments
 (0)