linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] btrfs: Remove redundant code from btrfs_free_stale_devices
Date: Thu, 30 Jul 2020 13:01:41 +0800	[thread overview]
Message-ID: <59efd39e-6d19-2d7e-00f9-d9b86a9b57cf@oracle.com> (raw)
In-Reply-To: <20200722080925.6802-4-nborisov@suse.com>

On 22/7/20 4:09 pm, Nikolay Borisov wrote:
> Following the refactor of btrfs_free_stale_devices in
> 7bcb8164ad94 ("btrfs: use device_list_mutex when removing stale devices")
> fs_devices are freed after they have been iterated by the inner
> list_for_each so the UAF fixed by introducing the break in
> fd649f10c3d2 ("btrfs: Fix use-after-free when cleaning up fs_devs with
> a single stale device") is no longer necessary. Just remove it
> altogether. No functional changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>   fs/btrfs/volumes.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 384614fe0e2a..17047c118969 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -588,8 +588,6 @@ static int btrfs_free_stale_devices(const char *path,
>   			btrfs_free_device(device);
>   
>   			ret = 0;
> -			if (fs_devices->num_devices == 0)
> -				break;
>   		}
>   		mutex_unlock(&fs_devices->device_list_mutex);
>   
> 


Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand

  reply	other threads:[~2020-07-30  5:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  8:09 [PATCH 0/4] Misc cleanups around device addition Nikolay Borisov
2020-07-22  8:09 ` [PATCH 1/4] btrfs: Use rcu when iterating devices in btrfs_init_new_device Nikolay Borisov
2020-07-22  9:17   ` Johannes Thumshirn
2020-07-22 10:36     ` Nikolay Borisov
2020-07-22 14:47       ` David Sterba
2020-07-22 14:53         ` Johannes Thumshirn
2020-07-23  7:45         ` Nikolay Borisov
2020-07-22  8:09 ` [PATCH 2/4] btrfs: Refactor locked condition " Nikolay Borisov
2020-07-30  4:31   ` Anand Jain
2020-07-22  8:09 ` [PATCH 3/4] btrfs: Remove redundant code from btrfs_free_stale_devices Nikolay Borisov
2020-07-30  5:01   ` Anand Jain [this message]
2020-07-22  8:09 ` [PATCH 4/4] btrfs: Don't opencode sync_blockdev Nikolay Borisov
2020-07-22  9:20   ` Johannes Thumshirn
2020-07-30  5:05   ` Anand Jain
2020-08-26 16:07 ` [PATCH 0/4] Misc cleanups around device addition Nikolay Borisov
2020-08-28 15:48 ` David Sterba

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=59efd39e-6d19-2d7e-00f9-d9b86a9b57cf@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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).