]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Don't dereference em if it's NULL or an error pointer.
authorRoel Kluin <roel.kluin@gmail.com>
Sat, 16 Jul 2011 13:30:55 +0000 (23:30 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 26 Jul 2011 05:04:57 +0000 (15:04 +1000)
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 e91b097e7252a911dcaa61eed0188bfeae500d2a..1694e378a9192d9720e065ed0d3d479a850dcb4d 100644 (file)
@@ -1864,7 +1864,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;
                }