1. 16 Feb, 2011 1 commit
  2. 14 Feb, 2011 6 commits
    • Tsutomu Itoh's avatar
      Btrfs: check return value of alloc_extent_map() · c26a9203
      Tsutomu Itoh authored
      I add the check on the return value of alloc_extent_map() to several places.
      In addition, alloc_extent_map() returns only the address or NULL.
      Therefore, check by IS_ERR() is unnecessary. So, I remove IS_ERR() checking.
      Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      c26a9203
    • Ilya Dryomov's avatar
      Btrfs - Fix memory leak in btrfs_init_new_device() · 67100f25
      Ilya Dryomov authored
      Memory allocated by calling kstrdup() should be freed.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      67100f25
    • Dan Rosenberg's avatar
      btrfs: prevent heap corruption in btrfs_ioctl_space_info() · 51788b1b
      Dan Rosenberg authored
      Commit bf5fc093 refactored
      btrfs_ioctl_space_info() and introduced several security issues.
      
      space_args.space_slots is an unsigned 64-bit type controlled by a
      possibly unprivileged caller.  The comparison as a signed int type
      allows providing values that are treated as negative and cause the
      subsequent allocation size calculation to wrap, or be truncated to 0.
      By providing a size that's truncated to 0, kmalloc() will return
      ZERO_SIZE_PTR.  It's also possible to provide a value smaller than the
      slot count.  The subsequent loop ignores the allocation size when
      copying data in, resulting in a heap overflow or write to ZERO_SIZE_PTR.
      
      The fix changes the slot count type and comparison typecast to u64,
      which prevents truncation or signedness errors, and also ensures that we
      don't copy more data than we've allocated in the subsequent loop.  Note
      that zero-size allocations are no longer possible since there is already
      an explicit check for space_args.space_slots being 0 and truncation of
      this value is no longer an issue.
      Signed-off-by: default avatarDan Rosenberg <drosenberg@vsecurity.com>
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      Reviewed-by: default avatarJosef Bacik <josef@redhat.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      51788b1b
    • Yan, Zheng's avatar
      Btrfs: Fix balance panic · 6848ad64
      Yan, Zheng authored
      Mark the cloned backref_node as checked in clone_backref_node()
      Signed-off-by: default avatarYan, Zheng <zheng.z.yan@intel.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      6848ad64
    • Chris Mason's avatar
      Btrfs: don't release pages when we can't clear the uptodate bits · e3f24cc5
      Chris Mason authored
      Btrfs tracks uptodate state in an rbtree as well as in the
      page bits.  This is supposed to enable us to use block sizes other than
      the page size, but there are a few parts still missing before that
      completely works.
      
      But, our readpage routine trusts this additional range based tracking
      of uptodateness, much in the same way the buffer head up to date bits
      are trusted for the other filesystems.
      
      The problem is that sometimes we need to allocate memory in order to
      split records in the rbtree, even when we are just clearing bits.  This
      can be difficult when our clearing function is called GFP_ATOMIC, which
      can happen in the releasepage path.
      
      So, what happens today looks like this:
      
      releasepage called with GFP_ATOMIC
      btrfs_releasepage calls clear_extent_bit
      clear_extent_bit fails to allocate ram, leaving the up to date bit set
      btrfs_releasepage returns success
      
      The end result is the page being gone, but btrfs thinking the range is
      up to date.   Later on if someone tries to read that same page, the
      btrfs readpage code will return immediately thinking the page is already
      up to date.
      
      This commit fixes things to fail the releasepage when we can't clear the
      extent state bits.  It covers both data pages and metadata tree blocks.
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      e3f24cc5
    • Chris Mason's avatar
      Btrfs: fix page->private races · eb14ab8e
      Chris Mason authored
      There is a race where btrfs_releasepage can drop the
      page->private contents just as alloc_extent_buffer is setting
      up pages for metadata.  Because of how the Btrfs page flags work,
      this results in us skipping the crc on the page during IO.
      
      This patch sovles the race by waiting until after the extent buffer
      is inserted into the radix tree before it sets page private.
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      eb14ab8e
  3. 07 Feb, 2011 1 commit
  4. 06 Feb, 2011 4 commits
  5. 01 Feb, 2011 3 commits
  6. 31 Jan, 2011 2 commits
    • Chris Mason's avatar
      Btrfs: catch errors from btrfs_sync_log · b31eabd8
      Chris Mason authored
      btrfs_sync_log returns -EAGAIN when we need full transaction commits
      instead of small log commits, but sometimes we were dropping the return
      value.
      
      In practice, we check for this a few different ways, but this is still a
      bug that can leave off full log commits when we really need them.
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      b31eabd8
    • Josef Bacik's avatar
      Btrfs: make shrink_delalloc a little friendlier · b1953bce
      Josef Bacik authored
      Xfstests 224 will just sit there and spin for ever until eventually we give up
      flushing delalloc and exit.  On my box this took several hours.  I could not
      interrupt this process either, even though we use INTERRUPTIBLE.  So do 2 things
      
      1) Keep us from looping over and over again without reclaiming anything
      2) If we get interrupted exit the loop
      
      I tested this and the test now exits in a reasonable amount of time, and can be
      interrupted with ctrl+c.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      b1953bce
  7. 28 Jan, 2011 12 commits
  8. 26 Jan, 2011 11 commits