mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
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/20250129222003.1495713-1-bvanassche@acm.org
Fixes: 0f3b1c40c6
("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Baoquan he <bhe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
0ad2507d5d
commit
c8a3e63ff9
1 changed files with 4 additions and 1 deletions
|
@ -1524,7 +1524,7 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
|
||||||
pr_warn_once("Unexpected adding of device dump\n");
|
pr_warn_once("Unexpected adding of device dump\n");
|
||||||
if (vmcore_open) {
|
if (vmcore_open) {
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto out_err;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(&dump->list, &vmcoredd_list);
|
list_add_tail(&dump->list, &vmcoredd_list);
|
||||||
|
@ -1532,6 +1532,9 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
|
||||||
mutex_unlock(&vmcore_mutex);
|
mutex_unlock(&vmcore_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
unlock:
|
||||||
|
mutex_unlock(&vmcore_mutex);
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
vfree(buf);
|
vfree(buf);
|
||||||
vfree(dump);
|
vfree(dump);
|
||||||
|
|
Loading…
Add table
Reference in a new issue