All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 5/7] Btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO
Date: Thu, 7 Sep 2017 10:24:53 -0700	[thread overview]
Message-ID: <20170907172453.GB17057@vader.DHCP.thefacebook.com> (raw)
In-Reply-To: <20170906153728.GW31874@twin.jikos.cz>

On Wed, Sep 06, 2017 at 05:37:28PM +0200, David Sterba wrote:
> On Tue, Aug 22, 2017 at 11:46:03PM -0700, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > A naked read of the value of an RCU pointer isn't safe. Put the whole
> > access in an RCU critical section, not just the pointer dereference.
> 
> In this case it is safe, as the device will not go away (and potentially
> free dev->name) because it's under the device_list_mutex.
> 
> The locking around devices and related structures is not exactly
> straightforward, but here I don't think we need to stick to the RCU
> pattern if the protection is guaranteed by other means. This applies to
> uuid_mutex and device_list_mutex.

You're right, it's a little confusing because uuid_mutex protects
device->name, so under device_list_mutex, device->name might change but
will never become NULL. We can just drop this one, thanks!

  reply	other threads:[~2017-09-07 17:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  6:45 [PATCH 0/7] Btrfs: bugs found by sparse and RCU strings Omar Sandoval
2017-08-23  6:45 ` [PATCH 1/7] Btrfs: fix blk_status_t/errno confusion Omar Sandoval
2017-08-23 15:50   ` David Sterba
2017-08-23 16:13   ` Liu Bo
2017-08-23 19:18     ` Omar Sandoval
2017-08-23  6:46 ` [PATCH 2/7] Btrfs: fix incorrect {node,sector}size endianness from BTRFS_IOC_FS_INFO Omar Sandoval
2017-09-06 14:51   ` David Sterba
2017-08-23  6:46 ` [PATCH 3/7] Move Btrfs RCU string to common library Omar Sandoval
2017-09-06 15:15   ` David Sterba
2017-09-07 17:10     ` Omar Sandoval
2017-08-23  6:46 ` [PATCH 4/7] Btrfs: refactor btrfs_device->name updates Omar Sandoval
2017-08-23  6:46 ` [PATCH 5/7] Btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO Omar Sandoval
2017-09-06 15:37   ` David Sterba
2017-09-07 17:24     ` Omar Sandoval [this message]
2017-08-23  6:46 ` [PATCH 6/7] Btrfs: make some volumes.c functions static Omar Sandoval
2017-09-06 15:25   ` David Sterba
2017-08-23  6:46 ` [PATCH 7/7] Btrfs: fix __user casting in ioctl.c Omar Sandoval
2017-09-06 15:23   ` 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=20170907172453.GB17057@vader.DHCP.thefacebook.com \
    --to=osandov@osandov.com \
    --cc=dsterba@suse.cz \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.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.