From patchwork Mon Nov 19 08:24:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yang X-Patchwork-Id: 1763441 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 C13863FCDE for ; Mon, 19 Nov 2012 08:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753183Ab2KSIZC (ORCPT ); Mon, 19 Nov 2012 03:25:02 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:4453 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752829Ab2KSIZB (ORCPT ); Mon, 19 Nov 2012 03:25:01 -0500 X-IronPort-AV: E=Sophos;i="4.83,278,1352044800"; d="scan'208";a="6229403" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 19 Nov 2012 16:23:19 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qAJ8P0Pp003200 for ; Mon, 19 Nov 2012 16:25:00 +0800 Received: from fedora.vm ([10.167.225.168]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012111916244753-1232105 ; Mon, 19 Nov 2012 16:24:47 +0800 From: Chen Yang To: linux-btrfs@vger.kernel.org Cc: Chen Yang Subject: [PATCH] Btrfs-progs: Fix a segmentation fault in btrfstune when is invalid. Date: Mon, 19 Nov 2012 16:24:30 +0800 Message-Id: <1353313470-25087-1-git-send-email-chenyang.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.7.6 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/19 16:24:47, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/19 16:24:47, Serialize complete at 2012/11/19 16:24:47 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When open_ctree(device, ...) failed, the return value should be checked. Signed-off-by: Cheng Yang --- btrfstune.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/btrfstune.c b/btrfstune.c index 47830c5..07648d5 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -107,6 +107,8 @@ int main(int argc, char *argv[]) } root = open_ctree(device, 0, 1); + if (!root) + return 1; if (seeding_flag) { ret = update_seeding_flag(root, seeding_value);