Skip to content

Commit c8a3e63

Browse files
bvanasscheakpm00
authored andcommitted
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: 0f3b1c4 ("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]>
1 parent 0ad2507 commit c8a3e63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/proc/vmcore.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,14 +1524,17 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
15241524
pr_warn_once("Unexpected adding of device dump\n");
15251525
if (vmcore_open) {
15261526
ret = -EBUSY;
1527-
goto out_err;
1527+
goto unlock;
15281528
}
15291529

15301530
list_add_tail(&dump->list, &vmcoredd_list);
15311531
vmcoredd_update_size(data_size);
15321532
mutex_unlock(&vmcore_mutex);
15331533
return 0;
15341534

1535+
unlock:
1536+
mutex_unlock(&vmcore_mutex);
1537+
15351538
out_err:
15361539
vfree(buf);
15371540
vfree(dump);

0 commit comments

Comments
 (0)