Skip to content

Commit 6cb05d8

Browse files
pchelkin91ChristianKoenigAMD
authored andcommitted
dma-buf: handle testing kthreads creation failure
kthread creation may possibly fail inside race_signal_callback(). In such a case stop the already started threads, put the already taken references to them and return with error code. Found by Linux Verification Center (linuxtesting.org). Fixes: 2989f64 ("dma-buf: Add selftests for dma-fence") Cc: [email protected] Signed-off-by: Fedor Pchelkin <[email protected]> Reviewed-by: T.J. Mercier <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Christian König <[email protected]>
1 parent 779aa4d commit 6cb05d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/dma-buf/st-dma-fence.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ static int race_signal_callback(void *arg)
540540
t[i].before = pass;
541541
t[i].task = kthread_run(thread_signal_callback, &t[i],
542542
"dma-fence:%d", i);
543+
if (IS_ERR(t[i].task)) {
544+
ret = PTR_ERR(t[i].task);
545+
while (--i >= 0)
546+
kthread_stop_put(t[i].task);
547+
return ret;
548+
}
543549
get_task_struct(t[i].task);
544550
}
545551

0 commit comments

Comments
 (0)