From 21ebcb40ce995b56fbc8f528df76ed94b7eb0909 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 3 Aug 2011 10:52:38 +1000 Subject: [PATCH] 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 --- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 15fceefbca0a..bb85e484da08 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; } -- 2.39.5