procfs: Fix a locking bug in a vmcore_add_device_dump() error path
Subsystems (4)
PATCH 1/1 procfs: Fix a locking bug in a vmcore_add_device_dump() error path
Unlock vmcore_mutex when returning -EBUSY.
--- fs/proc/vmcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/proc/vmcore.c +4 -1
@@ -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);
Quoted 7 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>
Quoted 27 lines
--- fs/proc/vmcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/proc/vmcore.c +4
-1@@ -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);
Andrew Morton
maintainerQuoted 10 lines · On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 7 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>
This applies to patches which are in linux-next via your tree (I think), so I'll take the above to mean "thanks, applied" ;)
btw, 0f3b1c40c652 doesn't have a Link: tag. Please add to your todo list?
Quoted 11 lines · Andrew Morton
Quoted 9 lines · On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 7 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>
Quoted 4 lines
Quoted 1 line
This applies to patches which are in linux-next via your tree (I think), so I'll take the above to mean "thanks, applied" ;)
Is my understanding correct that the commit fixed by this patch made it into Linus' tree a few days ago?
$ git log --after=2025-01-26 --before=2025-01-27 origin/master | \
grep 0f3b1c40c652
commit 0f3b1c40c65262a216fb459fd375f39442a5138bThanks,
Bart.
Andrew Morton
maintainerQuoted 12 lines · On Thu, 30 Jan 2025 17:02:08 -0800 Bart Van Assche <[email protected]> wrote:
Quoted 11 lines · Andrew Morton
Quoted 9 lines · On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 7 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This applies to patches which are in linux-next via your tree (I think), so I'll take the above to mean "thanks, applied" ;)
Is my understanding correct that the commit fixed by this patch made it into Linus' tree a few days ago?
Ah, OK, thanks, grabbed.
(So that's what "git pull" does. I'll have to write that down.)
Quoted 19 lines · Andrew Morton
Quoted 17 lines · On Thu, 30 Jan 2025 17:02:08 -0800 Bart Van Assche <[email protected]> wrote:
Quoted 15 lines · Andrew Morton
Quoted 10 lines · On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 7 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>This applies to patches which are in linux-next via your tree (I think), so I'll take the above to mean "thanks, applied" ;)
Quoted 7 lines
Quoted 3 lines
Is my understanding correct that the commit fixed by this patch made it into Linus' tree a few days ago?
Ah, OK, thanks, grabbed.
(So that's what "git pull" does. I'll have to write that down.)
:)
Thanks.
Quoted 16 lines · Bart Van Assche
Unlock
vmcore_mutexwhen returning-EBUSY.Cc David Hildenbrand <[email protected]>Cc Andrew Morton <[email protected]>Cc Michael S. Tsirkin <[email protected]>Fixes 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")Signed-off-by Bart Van Assche <[email protected]>--- fs/proc/vmcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/proc/vmcore.cfs/proc/vmcore.c renamed from fs/proc/vmcore.c +0
-0
fs/proc/vmcore.cfs/proc/vmcore.c int vmcore_add_device_dump(struct vmcoredd_data *data) · line 1527
Quoted 5 lines
fs/proc/vmcore.cfs/proc/vmcore.c renamed from fs/proc/vmcore.c +1
-1@@ -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;
Thanks!
Signature · 3 lines
Cheers, David / dhildenb