From patchwork Mon Mar 4 16:25:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 2213281 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 251543FCF2 for ; Mon, 4 Mar 2013 16:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932114Ab3CDQ1U (ORCPT ); Mon, 4 Mar 2013 11:27:20 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:33403 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758498Ab3CDQ1R (ORCPT ); Mon, 4 Mar 2013 11:27:17 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r24GRGa1019133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 4 Mar 2013 16:27:16 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r24GRFuE011186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 4 Mar 2013 16:27:16 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r24GRFdY020919 for ; Mon, 4 Mar 2013 10:27:15 -0600 Received: from liubo.jp.oracle.com (/10.191.11.1) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Mar 2013 08:27:15 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/6] Btrfs: check for NULL pointer in updating reloc roots Date: Tue, 5 Mar 2013 00:25:36 +0800 Message-Id: <1362414341-17306-2-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1362414341-17306-1-git-send-email-bo.li.liu@oracle.com> References: <1362414341-17306-1-git-send-email-bo.li.liu@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Add a check for NULL pointer to avoid invalid reference. Signed-off-by: Liu Bo --- fs/btrfs/relocation.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 300e09a..d9be73b 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1269,6 +1269,8 @@ static int __update_reloc_root(struct btrfs_root *root, int del) } spin_unlock(&rc->reloc_root_tree.lock); + if (!node) + return 0; BUG_ON((struct btrfs_root *)node->data != root); if (!del) {