From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 49B372E89 for ; Wed, 4 Sep 2013 09:37:49 +0200 (CEST) Received: by mail-pd0-f178.google.com with SMTP id w10so7174296pde.9 for ; Wed, 04 Sep 2013 00:38:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5NE+wWAhKyep4Wr44o3iBVL/IUJ7m0LT5RhXIwMwU80=; b=m3xS1MAv6IYKuHf7q4xjSFp5FQygg3Do5G6VR5nf9INZyybuM0zUcKxEqYB0wJHTVP M3uT6G4d2z3wwxnd3C+YZkHnjdaTGOYqYvFF+BrIVqNkp+S4eNxNhU+ymVd0ayxVZFCN R6WYRmJTAMOS5eTRjbb41b12olA6diPTLm3xWXzekNYXxg/I/fAU/MPtJS/sqfG1uOXS E/FBupjwS4d/hbpcx4hWQGqy2Pn6I25Hm86vxPFbqdwt3COBFBkv9Da1pTfS1Xq5oBHM 9T1f+tr20JSpLM8LX6ji3qeiD11sdXl+6RP+uYbc+v3vL1ZycbqRXnoVbgbfWamseUNb BtTQ== X-Gm-Message-State: ALoCoQl4g65wudY7d/k6aKeFGxCiEjFa+3t+17EkeycqZp05oftMQg2sAiXIRtxEKXsIbk6hG4iT X-Received: by 10.68.106.99 with SMTP id gt3mr1742199pbb.116.1378280303118; Wed, 04 Sep 2013 00:38:23 -0700 (PDT) Received: from [10.16.129.101] ([219.106.231.132]) by mx.google.com with ESMTPSA id tg7sm27101013pbc.36.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 00:38:22 -0700 (PDT) Message-ID: <5226E36D.1090004@igel.co.jp> Date: Wed, 04 Sep 2013 16:38:21 +0900 From: "Tetsuya.Mukawa" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: dev@dpdk.org, thomas.monjalon@6wind.com References: <1378280075-2076-1-git-send-email-mukawa@igel.co.jp> In-Reply-To: <1378280075-2076-1-git-send-email-mukawa@igel.co.jp> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] pci: fix closing an unopened file descriptor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Sep 2013 07:37:49 -0000 Hi Thomas, I've sent the patch to fix an uninitialized variable access. Could you please check it? I will send ver.2 patch if I need. Thanks, Tetsuya Mukawa (2013/09/04 16:34), Tetsuya Mukawa wrote: > If CONFIG_RTE_EAL_UNBIND_PORTS is set and virtio-net is used, an unopened > file descriptor will be illegally closed in the finalized phase of EAL. > The fix adds a correct initial value to the file descriptor, and check it > before closing it. > > Signed-off-by: Tetsuya Mukawa > --- > lib/librte_eal/linuxapp/eal/eal_pci.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index c793148..7c04ba3 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -519,6 +519,8 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, > dev->addr.devid = devid; > dev->addr.function = function; > > + dev->intr_handle.fd = -1; > + > /* get vendor id */ > rte_snprintf(filename, sizeof(filename), "%s/vendor", dirname); > if (eal_parse_sysfs_value(filename, &tmp) < 0) { > @@ -718,7 +720,8 @@ pci_exit_process(struct rte_pci_device *dev) > RTE_LOG(ERR, EAL, "Error with munmap\n"); > return -1; > } > - if (close(dev->intr_handle.fd) == -1){ > + if ((dev->intr_handle.fd != -1) && > + (close(dev->intr_handle.fd) == -1)) { > RTE_LOG(ERR, EAL, "Error closing interrupt handle\n"); > return -1; > }