From: Roel Kluin Date: Tue, 26 Jul 2011 10:14:43 +0000 (+1000) Subject: Don't dereference em if it's NULL or an error pointer. X-Git-Tag: next-20110802~1^2~54 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4198a5ac91fb10c60c47d7f6d32f49ba9b45f43b;p=karo-tx-linux.git Don't dereference em if it's NULL or an error pointer. Signed-off-by: Roel Kluin Cc: Chris Mason Signed-off-by: Andrew Morton --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ae762dab37f8..4c4c4af7ccbc 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1865,7 +1865,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; }