linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Phil Turnbull <phil.turnbull@oracle.com>,
	linux-ext4@vger.kernel.org, Eryu Guan <guaneryu@gmail.com>
Subject: Re: [PATCH] ext4: check for extents that wrap around
Date: Thu, 30 Jun 2016 11:54:52 -0400	[thread overview]
Message-ID: <20160630155452.GH2028@thunk.org> (raw)
In-Reply-To: <1467239688-2588-1-git-send-email-vegard.nossum@oracle.com>

On Thu, Jun 30, 2016 at 12:34:48AM +0200, Vegard Nossum wrote:
> An extent with lblock = 4294967295 and len = 1 will pass the
> ext4_valid_extent() test:
> 
> 	ext4_lblk_t last = lblock + len - 1;
> 
> 	if (len == 0 || lblock > last)
> 		return 0;
> 
> since last = 4294967295 + 1 - 1 = 4294967295. This would later trigger
> the BUG_ON(es->es_lblk + es->es_len < es->es_lblk) in ext4_es_end().
> 
> We can simplify it by removing the - 1 altogether and changing the test
> to use lblock + len <= lblock, since now if len = 0, then lblock + 0 ==
> lblock and it fails, and if len > 0 then lblock + len > lblock in order
> to pass (i.e. it doesn't overflow).
> 
> Fixes: 5946d0893 ("ext4: check for overlapping extents in ext4_valid_extent_entries()")
> Fixes: 2f974865f ("ext4: check for zero length extent explicitly")
> Cc: Eryu Guan <guaneryu@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>

Thanks, applied.

						- Ted

      reply	other threads:[~2016-06-30 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 22:34 [PATCH] ext4: check for extents that wrap around Vegard Nossum
2016-06-30 15:54 ` Theodore Ts'o [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=20160630155452.GH2028@thunk.org \
    --to=tytso@mit.edu \
    --cc=guaneryu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=phil.turnbull@oracle.com \
    --cc=vegard.nossum@oracle.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).