diff options
| author | Bart Van Assche <[email protected]> | 2025-01-29 22:20:03 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-02-18 06:40:00 +0000 |
| commit | c8a3e63ff9d75b9f3f031c90d218876051dea0ba (patch) | |
| tree | 247881e17256b618a7c1837ae507b4e88116dfa7 | |
| parent | Linux 6.14-rc3 (diff) | |
| download | kernel-c8a3e63ff9d75b9f3f031c90d218876051dea0ba.tar.gz kernel-c8a3e63ff9d75b9f3f031c90d218876051dea0ba.zip | |
procfs: fix a locking bug in a vmcore_add_device_dump() error path
Unlock vmcore_mutex when returning -EBUSY.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")
Signed-off-by: Bart Van Assche <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Cc: Baoquan he <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | fs/proc/vmcore.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |
