From patchwork Mon Jul 7 14:35:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 4495371 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A7D889F392 for ; Mon, 7 Jul 2014 14:36:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D755220328 for ; Mon, 7 Jul 2014 14:36:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08DBC2021F for ; Mon, 7 Jul 2014 14:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754177AbaGGOgG (ORCPT ); Mon, 7 Jul 2014 10:36:06 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:50596 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753920AbaGGOgE (ORCPT ); Mon, 7 Jul 2014 10:36:04 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s67Ea34l013371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Jul 2014 14:36:03 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s67Ea1DT004341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 7 Jul 2014 14:36:02 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s67Ea1EH004354 for ; Mon, 7 Jul 2014 14:36:01 GMT Received: from localhost.localdomain.localdomain (/117.36.89.119) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Jul 2014 07:36:00 -0700 From: Liu Bo To: linux-btrfs Subject: [PATCH] Btrfs-progs: fix Segmentation fault of btrfs-convert Date: Mon, 7 Jul 2014 22:35:53 +0800 Message-Id: <1404743753-24856-1-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 1.8.1.4 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Recently we merge a memory leak fix, which fails xfstests/btrfs/012, the cause is that it only frees @fs_devices but leaves it on the global fs_uuid list, which cause a 'Segmentation fault' over running command btrfs-convert. This fixes the problem. Signed-off-by: Liu Bo --- volumes.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/volumes.c b/volumes.c index a61928c..8b827fa 100644 --- a/volumes.c +++ b/volumes.c @@ -184,11 +184,17 @@ again: seed_devices = fs_devices->seed; fs_devices->seed = NULL; if (seed_devices) { + struct btrfs_fs_devices *orig; + + orig = fs_devices; fs_devices = seed_devices; + list_del(&orig->list); + free(orig); goto again; + } else { + list_del(&fs_devices->list); + free(fs_devices); } - - free(fs_devices); return 0; }