All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Baoquan He <bhe@redhat.com>,
	kexec@lists.infradead.org, David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path
Date: Thu, 30 Jan 2025 02:02:38 -0500	[thread overview]
Message-ID: <20250130020209-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250129222003.1495713-1-bvanassche@acm.org>

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);



  reply	other threads:[~2025-01-30  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250130020209-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=david@redhat.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.