]> Git Repo - linux.git/commitdiff
dma-buf: handle testing kthreads creation failure
authorFedor Pchelkin <[email protected]>
Wed, 22 May 2024 18:13:08 +0000 (21:13 +0300)
committerChristian König <[email protected]>
Mon, 27 May 2024 14:09:22 +0000 (16:09 +0200)
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: 2989f6451084 ("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]>
drivers/dma-buf/st-dma-fence.c

index b7c6f7ea9e0c83910b5a7d5001c25e0b96fa7492..6a1bfcd0cc21081cb42db82b3c61032ad2e401b2 100644 (file)
@@ -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);
                }
 
This page took 0.072204 seconds and 4 git commands to generate.