Skip to contentSkip to conversation

FAILED: patch "[PATCH] dma-buf: handle testing kthreads creation failure" failed to apply to 6.1-stable tree

PATCH [email protected] 1 participant 1 message Jun 18, 2024

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 6cb05d89fd62a76a9b74bd16211fb0930e89fea8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024061836-game-handstand-9498@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

6cb05d89fd62 ("dma-buf: handle testing kthreads creation failure")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 6cb05d89fd62a76a9b74bd16211fb0930e89fea8 Mon Sep 17 00:00:00 2001
From: Fedor Pchelkin <[email protected]>
Date: Wed, 22 May 2024 21:13:08 +0300
Subject: [PATCH] dma-buf: handle testing kthreads creation failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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).

drivers/dma-buf/st-dma-fence.c +6 -0
index b7c6f7ea9e0c..6a1bfcd0cc21 100644
@@ -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);
 		}