All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: add stat check in open_ctree_fs_info
Date: Thu, 17 Mar 2016 08:58:58 +0000 (UTC)	[thread overview]
Message-ID: <pan$5827c$2850555c$6b75a991$da57cc2e@cox.net> (raw)
In-Reply-To: 1458141971-56355-1-git-send-email-ahferroin7@gmail.com

Austin S. Hemmelgarn posted on Wed, 16 Mar 2016 11:26:11 -0400 as
excerpted:

> Currently, open_ctree_fs_info will open whatever path you pass it and
> try to interpret it as a BTRFS filesystem.  While this is not
> nessecarily dangerous (except possibly if done on a character device),
> it does result in some rather cryptic and non-sensical error messages
> when trying to run certain commands in ways they weren't intended to be
> run.  Add a check using stat(2) to verify that the path we've been
> passed is in fact a regular file or a block device.
> 
> This causes the following commands to provide a helpful error message
> when run on a FIFO, directory, character device, or socket:

Umm... what about a symlink?  A symlink isn't a block device or regular 
file, but obviously with udev, symlinks to block devices /better/ work.  
Do you dereference symlinks before doing this check?


-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


  reply	other threads:[~2016-03-17  8:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 15:26 [PATCH] btrfs-progs: add stat check in open_ctree_fs_info Austin S. Hemmelgarn
2016-03-17  8:58 ` Duncan [this message]
2016-03-17 11:25   ` Austin S. Hemmelgarn
2016-03-17  9:04 ` Qu Wenruo
2016-03-17 11:22   ` Austin S. Hemmelgarn
2016-03-18  0:38     ` Qu Wenruo
2016-03-18 11:17       ` Austin S. Hemmelgarn
2016-03-18 15:03         ` David Sterba
2016-03-21  0:14         ` Qu Wenruo

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='pan$5827c$2850555c$6b75a991$da57cc2e@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --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.