FAILED: Patch "procfs: fix possible double mmput() in do_procmap_query()" failed to apply to 6.12-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-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]>.
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 61dc9f776705d6db6847c101b98fa4f0e9eb6fa3 Mon Sep 17 00:00:00 2001
From: Andrii Nakryiko <[email protected]>
Date: Tue, 10 Feb 2026 11:27:38 -0800
Subject: [PATCH] procfs: fix possible double mmput() in do_procmap_query()
When user provides incorrectly sized buffer for build ID for PROCMAP_QUERY we return with -ENAMETOOLONG error. After recent changes this condition happens later, after we unlocked mmap_lock/per-VMA lock and did mmput(), so original goto out is now wrong and will double-mmput() mm_struct. Fix by jumping further to clean up only vm_file and name_buf.
--- fs/proc/task_mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/task_mmu.c +2 -1
@@ -780,7 +780,7 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg) }else {if (karg.build_id_size < build_id_sz) { err = -ENAMETOOLONG ; - goto out; + goto out_file; } karg.build_id_size = build_id_sz; }
@@ -808,6 +808,7 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg) out:query_vma_teardown (&lock_ctx);mmput (mm); +out_file:if (vm_file)fput (vm_file);kfree (name_buf);
Signature · 1 line
2.51.0