From patchwork Thu Aug 19 09:28:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Surbhi Palande X-Patchwork-Id: 120322 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7J9TAJn002024 for ; Thu, 19 Aug 2010 09:29:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752072Ab0HSJ27 (ORCPT ); Thu, 19 Aug 2010 05:28:59 -0400 Received: from adelie.canonical.com ([91.189.90.139]:38320 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608Ab0HSJ26 (ORCPT ); Thu, 19 Aug 2010 05:28:58 -0400 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1Om1Qf-0000kF-EB for ; Thu, 19 Aug 2010 10:28:57 +0100 Received: from a91-152-75-238.elisa-laajakaista.fi ([91.152.75.238] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1Om1Qf-0005GS-8A for linux-btrfs@vger.kernel.org; Thu, 19 Aug 2010 10:28:57 +0100 From: Surbhi Palande To: linux-btrfs@vger.kernel.org Subject: [PATCH][btrfs-progs] Prevent a SIGSEGV by returning -1 from btrfs_search_slot() Date: Thu, 19 Aug 2010 12:28:56 +0300 Message-Id: <1282210136-3625-1-git-send-email-surbhi.palande@canonical.com> X-Mailer: git-send-email 1.7.0.4 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 (demeter.kernel.org [140.211.167.41]); Thu, 19 Aug 2010 09:29:11 +0000 (UTC) diff --git a/ctree.c b/ctree.c index f70e10c..8ec7bf8 100644 --- a/ctree.c +++ b/ctree.c @@ -1264,6 +1264,9 @@ again: key->objectid); b = read_node_slot(root, b, slot); + if (!b) { + return -1; + } } else { p->slots[level] = slot; if (ins_len > 0 &&