All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
@ 2025-01-29 22:20 Bart Van Assche
  2025-01-30  7:02 ` Michael S. Tsirkin
  2025-01-30 10:02 ` David Hildenbrand
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Van Assche @ 2025-01-29 22:20 UTC (permalink / raw)
  To: Baoquan He
  Cc: kexec, Bart Van Assche, David Hildenbrand, Andrew Morton,
	Michael S. Tsirkin

Unlock vmcore_mutex when returning -EBUSY.

Cc: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Fixes: 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 fs/proc/vmcore.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index a00120a3c099..10d01eb09c43 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -1524,7 +1524,7 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
 		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 vmcoredd_data *data)
 	mutex_unlock(&vmcore_mutex);
 	return 0;
 
+unlock:
+	mutex_unlock(&vmcore_mutex);
+
 out_err:
 	vfree(buf);
 	vfree(dump);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-02 14:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-29 22:20 [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path Bart Van Assche
2025-01-30  7:02 ` Michael S. Tsirkin
2025-01-30 23:58   ` Andrew Morton
2025-01-31  1:02     ` Bart Van Assche
2025-01-31  1:20       ` Andrew Morton
2025-02-02 14:23         ` Michael S. Tsirkin
2025-01-30 10:02 ` David Hildenbrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.