]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: don't dereference extent_mapping if NULL
authorRoel Kluin <roel.kluin@gmail.com>
Wed, 28 Sep 2011 00:49:43 +0000 (10:49 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 29 Sep 2011 06:07:52 +0000 (16:07 +1000)
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 <>
fs/btrfs/inode.c

index b2d004ad66a0159042c38f96691c92bb0c31537e..f2a18f733d4d14b03b690243d3c400e364c05e9d 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;
                }