Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 9 Nov 2014 22:30:24 +0000 (14:30 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 9 Nov 2014 22:30:24 +0000 (14:30 -0800)
Pull btrfs fix from Chris Mason:
 "It's a one liner for an error cleanup path that leads to crashes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error cleanup

fs/btrfs/file-item.c

index 783a94355efd0be2acd75d1a84b3860ec7a28740..84a2d1868271b86b1f6a771bf5cf734a8e45c3dc 100644 (file)
@@ -413,7 +413,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
        ret = 0;
 fail:
        while (ret < 0 && !list_empty(&tmplist)) {
-               sums = list_entry(&tmplist, struct btrfs_ordered_sum, list);
+               sums = list_entry(tmplist.next, struct btrfs_ordered_sum, list);
                list_del(&sums->list);
                kfree(sums);
        }