From patchwork Fri Dec 7 15:42:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Sheng-Hui X-Patchwork-Id: 1851171 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8BD73DF2EE for ; Fri, 7 Dec 2012 15:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756605Ab2LGPmO (ORCPT ); Fri, 7 Dec 2012 10:42:14 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:38145 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756438Ab2LGPmO (ORCPT ); Fri, 7 Dec 2012 10:42:14 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so546604pad.19 for ; Fri, 07 Dec 2012 07:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=wjMorqXNqNWMK06Y9xTT8g/p70C8K7SrAYL7RLqaJk0=; b=09ZG2KqVIks/Yit3Rn7bUn8NJ4WuH336j8/T7XO7fnMcTNgJg1MVa09GpXlqzYzx05 d9W6H0KxNEXpOc+Nfo9xwBsqVW1D/uOPTXRXNTkiRLjFgzx9+O80dXsYRCPW4sNW1CcT N3sHrExc/n79Mb8fo5WOo3LfL9WDGOoYDkCgRoeEKDv79O/pkCZsDfMBqN7llLRHUwDx In1ue8gBk2rn+kAq6WRcxVy2YKb+vSzlaNtC9ZG+8c/LJd0Le6ddxzvjv/7cSNuAboDo L+rlBCEcWaUwiRtrPoN2PTJudUYPHJVYvj6yD4QSvW/jBq8rm6xZRz1AFd9MqXassGKX V3QQ== Received: by 10.68.137.167 with SMTP id qj7mr16408853pbb.148.1354894931706; Fri, 07 Dec 2012 07:42:11 -0800 (PST) Received: from localhost ([122.70.1.172]) by mx.google.com with ESMTPS id o1sm6792936paw.0.2012.12.07.07.42.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Dec 2012 07:42:10 -0800 (PST) From: Wang Sheng-Hui To: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: make sure fs_info is not null before its field is used in __btrfs_panic Date: Fri, 7 Dec 2012 23:42:04 +0800 Message-Id: <1354894924-13050-1-git-send-email-shhuiw@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We should make sure fs_info is not null before we refer to its field. Add simple check here. Signed-off-by: Wang Sheng-Hui --- fs/btrfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 915ac14..c6a3633 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -280,7 +280,7 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, vaf.va = &args; errstr = btrfs_decode_error(fs_info, errno, nbuf); - if (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR) + if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)) panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n", s_id, function, line, &vaf, errstr);