linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs-progs: check return value of realpath(3)
Date: Wed, 16 Oct 2013 12:56:33 +0800	[thread overview]
Message-ID: <20131016045633.GB11404@dhcp-13-216.nay.redhat.com> (raw)
In-Reply-To: <20131015164941.GL5787@twin.jikos.cz>

On Tue, Oct 15, 2013 at 06:49:41PM +0200, David Sterba wrote:
> On Sat, Oct 12, 2013 at 11:47:52PM +0800, Eryu Guan wrote:
> > I hit a segfault when deleting a subvolume with very long name(>4096),
> 
> How do you get a valid pathname longer than PATH_MAX which is 4096 ?

Just as the steps in reproducer, you can try the following

path=/mnt/btrfs
for i in `seq 1 381`;do
	path="$path/subvol_$i"
	btrfs sub create $path
done
echo ${#path}  # len is 4093 here

((i++))
path="$path/subvol_$i"
btrfs sub create $path
echo ${#path}  # The length of absolute path of this subvolume is greater than 4096 now

Maybe just another bug of btrfs-progs?
> 
> > Fix it by checking return value of realpath(3), also fix the one in
> > find_mount_root().
> 
> The error handling itself is ok.

Thanks for the review!

Eryu

      reply	other threads:[~2013-10-16  4:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12 15:47 [PATCH] Btrfs-progs: check return value of realpath(3) Eryu Guan
2013-10-15 16:49 ` David Sterba
2013-10-16  4:56   ` Eryu Guan [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=20131016045633.GB11404@dhcp-13-216.nay.redhat.com \
    --to=guaneryu@gmail.com \
    --cc=dsterba@suse.cz \
    --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 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).