From patchwork Fri Oct 16 17:23:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7419741 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 081F09F1D5 for ; Fri, 16 Oct 2015 17:29:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E612209CD for ; Fri, 16 Oct 2015 17:29:03 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD63E209DC for ; Fri, 16 Oct 2015 17:29:00 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9B94F60713; Fri, 16 Oct 2015 10:29:00 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id 8F87160713 for ; Fri, 16 Oct 2015 10:28:59 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 16 Oct 2015 10:28:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,689,1437462000"; d="scan'208";a="828690220" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by fmsmga002.fm.intel.com with ESMTP; 16 Oct 2015 10:28:58 -0700 Subject: [PATCH] ndctl: fix double close in check_btt_autodetect From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 16 Oct 2015 13:23:16 -0400 Message-ID: <20151016172316.35267.76370.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 The recent leak fix, commit eb125ae77788 "ndctl: fix 'fd' leak in check_btt_autodetect", introduced a potential double-close in this test. Signed-off-by: Dan Williams --- lib/test-libndctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c index 821065993dd7..b0221335606e 100644 --- a/lib/test-libndctl.c +++ b/lib/test-libndctl.c @@ -722,6 +722,7 @@ static int check_btt_autodetect(struct ndctl_bus *bus, goto out; } close(fd); + fd = -1; rc = -ENXIO; if (ro != namespace->ro) {