mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
dma-buf: handle testing kthreads creation failure
commit6cb05d89fd
upstream. 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:2989f64510
("dma-buf: Add selftests for dma-fence") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: T.J. Mercier <tjmercier@google.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240522181308.841686-1-pchelkin@ispras.ru Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e946428439
commit
2d11505e79
1 changed files with 6 additions and 0 deletions
|
@ -540,6 +540,12 @@ static int race_signal_callback(void *arg)
|
|||
t[i].before = pass;
|
||||
t[i].task = kthread_run(thread_signal_callback, &t[i],
|
||||
"dma-fence:%d", i);
|
||||
if (IS_ERR(t[i].task)) {
|
||||
ret = PTR_ERR(t[i].task);
|
||||
while (--i >= 0)
|
||||
kthread_stop_put(t[i].task);
|
||||
return ret;
|
||||
}
|
||||
get_task_struct(t[i].task);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue