linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Jeff Moyer <jmoyer@redhat.com>,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [patch] fs: fix use after free in get_tree_bdev
Date: Tue, 11 Feb 2020 17:52:58 +0800	[thread overview]
Message-ID: <30e120fdaee4234fcacea2c2fd1cc0aa95f755d3.camel@themaw.net> (raw)
In-Reply-To: <x49a75q1fg8.fsf@segfault.boston.devel.redhat.com>

On Mon, 2020-02-10 at 13:10 -0500, Jeff Moyer wrote:
> Commit 6fcf0c72e4b9 ("vfs: add missing blkdev_put() in
> get_tree_bdev()")
> introduced a use-after-free of the bdev.  This was caught by fstests
> generic/085, which now results in a kernel panic.  Fix it.

Oops!
Thanks Jeff.

Acked-by: Ian Kent <raven@themaw.net>

> 
> Cc: stable@vger.kernel.org # v5.4+
> Fixes: 6fcf0c72e4b9 ("vfs: add missing blkdev_put() in
> get_tree_bdev()")
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
> 
> diff --git a/fs/super.c b/fs/super.c
> index cd352530eca9..a288cd60d2ae 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1302,8 +1302,8 @@ int get_tree_bdev(struct fs_context *fc,
>  	mutex_lock(&bdev->bd_fsfreeze_mutex);
>  	if (bdev->bd_fsfreeze_count > 0) {
>  		mutex_unlock(&bdev->bd_fsfreeze_mutex);
> -		blkdev_put(bdev, mode);
>  		warnf(fc, "%pg: Can't mount, blockdev is frozen",
> bdev);
> +		blkdev_put(bdev, mode);
>  		return -EBUSY;
>  	}
>  
> 


      reply	other threads:[~2020-02-11  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 18:10 [patch] fs: fix use after free in get_tree_bdev Jeff Moyer
2020-02-11  9:52 ` Ian Kent [this message]

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=30e120fdaee4234fcacea2c2fd1cc0aa95f755d3.camel@themaw.net \
    --to=raven@themaw.net \
    --cc=jmoyer@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).