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

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  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-30 10:02 ` David Hildenbrand
  1 sibling, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2025-01-30  7:02 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Baoquan He, kexec, David Hildenbrand, Andrew Morton

On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
> 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>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  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	[flat|nested] 7+ messages in thread

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  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 10:02 ` David Hildenbrand
  1 sibling, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2025-01-30 10:02 UTC (permalink / raw)
  To: Bart Van Assche, Baoquan He; +Cc: kexec, Andrew Morton, Michael S. Tsirkin

On 29.01.25 23:20, Bart Van Assche wrote:
> 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.cfs/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;


Thanks!

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



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

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  2025-01-30  7:02 ` Michael S. Tsirkin
@ 2025-01-30 23:58   ` Andrew Morton
  2025-01-31  1:02     ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2025-01-30 23:58 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Bart Van Assche, Baoquan He, kexec, David Hildenbrand

On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
> > 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>
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

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?


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

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  2025-01-30 23:58   ` Andrew Morton
@ 2025-01-31  1:02     ` Bart Van Assche
  2025-01-31  1:20       ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2025-01-31  1:02 UTC (permalink / raw)
  To: Andrew Morton, Michael S. Tsirkin; +Cc: Baoquan He, kexec, David Hildenbrand

On 1/30/25 3:58 PM, Andrew Morton wrote:
> On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
>> On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
>>> 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>
>>
>> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> 
> 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 0f3b1c40c65262a216fb459fd375f39442a5138b

Thanks,

Bart.


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

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  2025-01-31  1:02     ` Bart Van Assche
@ 2025-01-31  1:20       ` Andrew Morton
  2025-02-02 14:23         ` Michael S. Tsirkin
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2025-01-31  1:20 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Michael S. Tsirkin, Baoquan He, kexec, David Hildenbrand

On Thu, 30 Jan 2025 17:02:08 -0800 Bart Van Assche <bvanassche@acm.org> wrote:

> On 1/30/25 3:58 PM, Andrew Morton wrote:
> > On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> >> On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
> >>> 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>
> >>
> >> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > 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.)


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

* Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
  2025-01-31  1:20       ` Andrew Morton
@ 2025-02-02 14:23         ` Michael S. Tsirkin
  0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2025-02-02 14:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Bart Van Assche, Baoquan He, kexec, David Hildenbrand

On Thu, Jan 30, 2025 at 05:20:53PM -0800, Andrew Morton wrote:
> On Thu, 30 Jan 2025 17:02:08 -0800 Bart Van Assche <bvanassche@acm.org> wrote:
> 
> > On 1/30/25 3:58 PM, Andrew Morton wrote:
> > > On Thu, 30 Jan 2025 02:02:38 -0500 "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > 
> > >> On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
> > >>> 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>
> > >>
> > >> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > > 
> > > 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.)

:)
Thanks.



^ permalink raw reply	[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.