linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: check file extent backref offset underflow
Date: Mon, 29 Aug 2011 09:59:13 +0800	[thread overview]
Message-ID: <4E5AF271.9040606@cn.fujitsu.com> (raw)
In-Reply-To: <4E5AEAA1.1070200@intel.com>

Yan, Zheng wrote:
> Offset field in data extent backref can underflow if clone range ioctl
> is used. We can reliably detect the underflow because max file size is
> limited to 2^63 and max data extent size is limited by block group size.
> 
> Signed-off-by: Zheng Yan  <zheng.z.yan@intel.com>

Tested-by: Li Zefan <lizf@cn.fujitsu.com>

...
> @@ -3323,8 +3323,11 @@ static int find_data_references(struct reloc_control *rc,
>  	}
>  
>  	key.objectid = ref_objectid;
> -	key.offset = ref_offset;
>  	key.type = BTRFS_EXTENT_DATA_KEY;
> +	if (ref_offset > ((u64)-1 << 32))
> +		key.offset = 0;
> +	else
> +		key.offset = ref_offset;

This needs comment, as we're working around a corner case and a magic number is
used.

>  
>  	path->search_commit_root = 1;
>  	path->skip_locking = 1;
> --

      reply	other threads:[~2011-08-29  1:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29  1:25 [PATCH] btrfs: check file extent backref offset underflow Yan, Zheng
2011-08-29  1:59 ` Li Zefan [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=4E5AF271.9040606@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zheng.z.yan@intel.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).