Skip to contentSkip to conversation

FAILED: patch "[PATCH] dm-verity: avoid double increment of &use_bh_wq_enabled" failed to apply to 6.1-stable tree

PATCH New [email protected] 2 participants 2 messages Jul 20 – Jul 27

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 72e9ec2fe32b00994f41719cf77423fca67d48b2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072020-agent-amiss-f82c@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

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

From 72e9ec2fe32b00994f41719cf77423fca67d48b2 Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <[email protected]>
Date: Thu, 9 Jul 2026 21:33:16 +0200
Subject: [PATCH] dm-verity: avoid double increment of &use_bh_wq_enabled

verity_parse_opt_args is called twice, first with the only_modifier_opts, first with only_modifier_opts == true and then with only_modifier_opts == false. Thus, the static branch &use_bh_wq_enabled was incremented twice and the destructor verity_dtr would only decrement it once.

Fix tihs bug by only incrementing it on the first call, on the second call, when v->use_bh_wq is true, do nothing.

Assisted-by Claude:claude-opus-4-6
Fixes df326e7a0699 ("dm verity: allow optional args to alter primary args handling")
drivers/md/dm-verity-target.c +2 -0
index 9a9847f94c46..adfda1fdab6a 100644
@@ -1262,6 +1262,8 @@ static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
 			continue;
 
 		} else if (!strcasecmp(arg_name, DM_VERITY_OPT_TASKLET_VERIFY)) {
+			if (v->use_bh_wq)
+				continue;
 			v->use_bh_wq = true;
 			static_branch_inc(&use_bh_wq_enabled);
 			continue;
maintainer
#1 lore raw

PATCH 1/1 dm-verity: avoid double increment of &use_bh_wq_enabled

From: Mikulas Patocka <[email protected]>

[ Upstream commit 72e9ec2fe32b00994f41719cf77423fca67d48b2 ]

verity_parse_opt_args is called twice, first with the only_modifier_opts, first with only_modifier_opts == true and then with only_modifier_opts == false. Thus, the static branch &use_bh_wq_enabled was incremented twice and the destructor verity_dtr would only decrement it once.

Fix tihs bug by only incrementing it on the first call, on the second call, when v->use_bh_wq is true, do nothing.

Assisted-by Claude:claude-opus-4-6
Fixes df326e7a0699 ("dm verity: allow optional args to alter primary args handling")
---
 drivers/md/dm-verity-target.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/md/dm-verity-target.c +2 -0
index 53150024d2dd4e..54f9adaf5fcdc6 100644
@@ -1151,6 +1151,8 @@ static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
 			continue;
 
 		} else if (!strcasecmp(arg_name, DM_VERITY_OPT_TASKLET_VERIFY)) {
+			if (v->use_tasklet)
+				continue;
 			v->use_tasklet = true;
 			static_branch_inc(&use_tasklet_enabled);
 			continue;
Signature · 1 line
2.53.0