]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: don't dereference extent_mapping if NULL
authorRoel Kluin <roel.kluin@gmail.com>
Mon, 24 Oct 2011 14:53:36 +0000 (01:53 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 4 Nov 2011 04:48:08 +0000 (15:48 +1100)
Don't dereference em if it's NULL or an error pointer.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/btrfs/inode.c

index 75686a61bd4550c5adad9a9f56091ed42217de6d..4d621254da7e36e274cef126665a9df340d1f7b2 100644 (file)
@@ -1863,7 +1863,8 @@ static int btrfs_io_failed_hook(struct bio *failed_bio,
 
                read_lock(&em_tree->lock);
                em = lookup_extent_mapping(em_tree, start, failrec->len);
-               if (em->start > start || em->start + em->len < start) {
+               if (em && !IS_ERR(em) && (em->start > start ||
+                                       em->start + em->len < start)) {
                        free_extent_map(em);
                        em = NULL;
                }