The patch titled Subject: procfs: fix a locking bug in a vmcore_add_device_dump() error path has been added to the -mm mm-hotfixes-unstable branch. Its filename is procfs-fix-a-locking-bug-in-a-vmcore_add_device_dump-error-path.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/procfs-fix-a-locking-bug-in-a-vmcore_add_device_dump-error-path.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Bart Van Assche <bvanassche@xxxxxxx> Subject: procfs: fix a locking bug in a vmcore_add_device_dump() error path Date: Wed, 29 Jan 2025 14:20:03 -0800 Unlock vmcore_mutex when returning -EBUSY. Link: https://lkml.kernel.org/r/20250129222003.1495713-1-bvanassche@xxxxxxx Fixes: 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open") Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx> Acked-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Baoquan he <bhe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/vmcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/proc/vmcore.c~procfs-fix-a-locking-bug-in-a-vmcore_add_device_dump-error-path +++ a/fs/proc/vmcore.c @@ -1524,7 +1524,7 @@ int vmcore_add_device_dump(struct vmcore pr_warn_once("Unexpected adding of device dump\n"); if (vmcore_open) { ret = -EBUSY; - goto out_err; + goto unlock; } list_add_tail(&dump->list, &vmcoredd_list); @@ -1532,6 +1532,9 @@ int vmcore_add_device_dump(struct vmcore mutex_unlock(&vmcore_mutex); return 0; +unlock: + mutex_unlock(&vmcore_mutex); + out_err: vfree(buf); vfree(dump); _ Patches currently in -mm which might be from bvanassche@xxxxxxx are procfs-fix-a-locking-bug-in-a-vmcore_add_device_dump-error-path.patch