From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C7AAD8E85 for ; Fri, 27 Apr 2018 18:56:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 09:56:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,335,1520924400"; d="scan'208";a="36684577" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.252.25.158]) ([10.252.25.158]) by orsmga007.jf.intel.com with ESMTP; 27 Apr 2018 09:56:47 -0700 To: Bruce Richardson Cc: dev@dpdk.org, thomas@monjalon.net References: <20180427151554.GC80648@bricha3-MOBL.ger.corp.intel.com> From: "Burakov, Anatoly" Message-ID: <14e3fed3-9f9a-ad4d-4ccc-8f33f9cd1a41@intel.com> Date: Fri, 27 Apr 2018 17:56:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180427151554.GC80648@bricha3-MOBL.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 3/9] mem: fix potential double close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 16:56:51 -0000 On 27-Apr-18 4:15 PM, Bruce Richardson wrote: > On Wed, Apr 25, 2018 at 10:56:41AM +0100, Anatoly Burakov wrote: >> We were closing descriptor before checking if mapping has >> failed, but if it did, we did a second close afterwards. Fix >> it by moving closing descriptor to after we check if mmap has >> succeeded. >> >> Coverity issue: 272560 >> >> Fixes: 2a04139f66b4 ("eal: add single file segments option") >> Cc: anatoly.burakov@intel.com >> >> Signed-off-by: Anatoly Burakov >> --- > Is a better fix not to assign fd to -1 after closing and then checking that > in the error leg? > A betterer fix would've been to move close() to until after all errors are checked. Will do that instead :) -- Thanks, Anatoly