From: Roel Kluin Date: Mon, 24 Oct 2011 14:53:36 +0000 (+1100) Subject: btrfs: don't dereference extent_mapping if NULL X-Git-Tag: next-20111025~2^2~310 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2b6333deadbab91fa6ca10e12441cefe1cb89782;p=karo-tx-linux.git btrfs: don't dereference extent_mapping if NULL 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 b2d004ad66a0..f2a18f733d4d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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; }