From patchwork Mon Oct 19 11:37:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 7435211 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6945FBEEA4 for ; Mon, 19 Oct 2015 11:45:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A884B20664 for ; Mon, 19 Oct 2015 11:45:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBE8020608 for ; Mon, 19 Oct 2015 11:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751109AbbJSLpu (ORCPT ); Mon, 19 Oct 2015 07:45:50 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:32879 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbbJSLpt (ORCPT ); Mon, 19 Oct 2015 07:45:49 -0400 Received: by pabrc13 with SMTP id rc13so189450031pab.0 for ; Mon, 19 Oct 2015 04:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uy4viSRRXaARUsmeZDFhH/bdE/NnZektJ6F0ZRZS4Q8=; b=FgPFxK3JE5Sm/+ehWTSXr6iokd4Ibxd2uM7IdTWTe8hRHHIu1dZMoifW8bY0OQTKrf V39XJoiZwzs0E37oeHiP3Mpqr4ZovFauO/T/nb3ggJcmPpXPBsvFHM4U2iBYeEDewDKT VAo0eezaOdNRH5aiEKZPhohG4Bi8L9E9VBdWHCPIfConPtI0ETPXyJ1fWAWZuxDIabde I7wyJQqXxQtV6pNHvXw3hsSXAF+N6stdTAxRZBpLZKwzYSQMtTnAi9ZqOckyZgU2rYQw q80YINmhYzb7VuSUCcItT5+pNDGI0D+H1IA+SqoPzBlTEA+Wbm+wn2/5M4tGFFKs7Mhu 2KOg== X-Received: by 10.68.219.4 with SMTP id pk4mr34689510pbc.138.1445255148903; Mon, 19 Oct 2015 04:45:48 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id fa14sm36288119pac.8.2015.10.19.04.45.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 04:45:48 -0700 (PDT) From: Eryu Guan To: linux-btrfs@vger.kernel.org Cc: Eryu Guan Subject: [PATCH 06/10] btrfs-progs: vailidate pointer before dereferencing it in btrfs_cow_block() Date: Mon, 19 Oct 2015 19:37:56 +0800 Message-Id: <1445254680-11102-7-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> References: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check trans before dereferencing it. Signed-off-by: Eryu Guan --- ctree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctree.c b/ctree.c index 1434007..f9d972a 100644 --- a/ctree.c +++ b/ctree.c @@ -356,7 +356,7 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, WARN_ON(1); } */ - if (trans->transid != root->fs_info->generation) { + if (trans && trans->transid != root->fs_info->generation) { printk(KERN_CRIT "trans %llu running %llu\n", (unsigned long long)trans->transid, (unsigned long long)root->fs_info->generation);