From patchwork Wed Sep 29 22:20:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 218212 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8TKJfav027917 for ; Wed, 29 Sep 2010 20:19:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755756Ab0I2UTD (ORCPT ); Wed, 29 Sep 2010 16:19:03 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:45983 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755512Ab0I2UTB (ORCPT ); Wed, 29 Sep 2010 16:19:01 -0400 Received: by ewy23 with SMTP id 23so467636ewy.19 for ; Wed, 29 Sep 2010 13:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=/P5IUpGGIAy4W5ESiLCPdi/OdKyGO+zSuO4AUY2hiys=; b=SjmPgnNoXEVUOhp9dKi0542Pm+S1j1dc+4RxTb6VAbXrARqu7RJjIExwmTDqjPown+ As7v4CdzjvgfUYW0q5L1e9zwGZomVpCTicVO6Jpt/SYFfI4Yib5zac31Y5dBpTvugiw8 hQLmCP77/iY8nnwluEjl0DRcmjtepih0BBfdo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=j3KJN+FywYqZjm902PUajYcYpEkMOMWuq+7YMufcYfGP+zzwbuecHJT4BEmTOPPyYs Ovs0jTeyEOB3cWKd+A8vRjz9OqbzTenewru4R0uBDcifug27dKkenluC6zFDaW+n9YnL HhaEie6k5Phn1y6C4wzPZki8zneo2zyryfikI= Received: by 10.14.119.140 with SMTP id n12mr1273957eeh.0.1285791539916; Wed, 29 Sep 2010 13:18:59 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id v8sm12998489eeh.8.2010.09.29.13.18.58 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 13:18:58 -0700 (PDT) Message-ID: <4CA3BBAD.8080207@gmail.com> Date: Thu, 30 Sep 2010 00:20:29 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4 MIME-Version: 1.0 To: Chris Mason , linux-btrfs@vger.kernel.org, Andrew Morton , LKML Subject: [PATCH] Btrfs: Don't dereference extent_mapping if NULL Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 29 Sep 2010 20:19:41 +0000 (UTC) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c038644..d4a37f8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1787,7 +1787,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; }