From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 12BC41B5D4 for ; Fri, 23 Nov 2018 16:39:50 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181123153949euoutp02fb963ddfb1997c746a6e13072f77e96d~pywmSCt1V1137211372euoutp02X for ; Fri, 23 Nov 2018 15:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181123153949euoutp02fb963ddfb1997c746a6e13072f77e96d~pywmSCt1V1137211372euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542987589; bh=Rne5WI/8tSAztqjQgequ7oQKuxn715XgXhKau/R5kbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJlX4oFEYSq8sVdR3Ssp4hDnI/RzjP3wsaiNEdOxzxBTKXLDfmeJV4VDifYWqcs15 +BSZfq9t9ai1KdS53Q6oDz/63dCJeeDsFYDvX+MXLiHdiT8gfS6dW6GAJHhZi6LZPX U0NnoQ8r1yNdYncoDOGVEYrDQMSWPjQI6JVgzF6o= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181123153948eucas1p2161e1c7939575a914494f582021f1c40~pywlvBZ1w2227422274eucas1p2-; Fri, 23 Nov 2018 15:39:48 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 8F.A8.04441.44F18FB5; Fri, 23 Nov 2018 15:39:48 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e~pywk2TAEq0134401344eucas1p1E; Fri, 23 Nov 2018 15:39:47 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181123153947eusmtrp151d597718e9918024b11b4747adcd700~pywkl4q3A2017620176eusmtrp1d; Fri, 23 Nov 2018 15:39:47 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-b5-5bf81f44ce09 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 62.DA.04128.34F18FB5; Fri, 23 Nov 2018 15:39:47 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181123153946eusmtip2bd51d17bef8dfd2b615ed7875336316b~pywjyzcdX1840618406eusmtip2k; Fri, 23 Nov 2018 15:39:46 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org, David Marchand Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Thomas Monjalon , Ferruh Yigit , Ian Stokes , Kevin Traynor , Bruce Richardson , Ilya Maximets , stable@dpdk.org Date: Fri, 23 Nov 2018 18:39:19 +0300 Message-Id: <20181123153920.12398-2-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181123153920.12398-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMKsWRmVeSWpSXmKPExsWy7djPc7ou8j+iDa7cFbK4screYvuKLjaL d5+2M1nc2Xua3eJK+092i40Pz7JarD30gd3iWOceFot/HX/YLT49OMFisbXhP5PF5ouTmBx4 PH4tWMrqsXjPSyaPYzensXu833eVzaNvyyrGANYoLpuU1JzMstQifbsEroxzNx+xFKxlq2h9 fZm5gXEaaxcjB4eEgIlE89LULkYuDiGBFYwSRw+8ZIFwvjBK7D3czAThfGaUuPRyN2MXIydY x9VzX9hBbCGB5YwSy1qUIIp+MErcWn6OCSTBJqAjcWr1EUaQFSICNhLXPxWB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4CNxNofLSwQu3IlDt29yDSBkW8BI8MqRpHU0uLc9NxiI73ixNzi0rx0veT83E2MwCDfduzn FqBZ74IPMQpwMCrx8N5g+BEtxJpYVlyZe4hRgoNZSYS3SfF7tBBvSmJlVWpRfnxRaU5q8SFG U6CjJjJLiSbnAyMwryTe0NTQ3MLS0NzY3NjMQkmc97xBZZSQQHpiSWp2ampBahFMHxMHp1QD o9/Og7e3XW1ruba84Lr+v47b3Mt5H6nWTNWuPnYzmHOXs17Duya3rmf6+ed2Lje91vpqycXu Ixd+HDk+w3xtdUCev/Slbc0SCvO1tJqLFqnI77R/Y6olEfnhuoCysrqfjdGc4GgmnTCRpKkZ 9mrn72ULcYS92M166V5/243wlsVb33Lf2RxzWomlOCPRUIu5qDgRAEexkcWIAgAA X-CMS-MailID: 20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e References: <20181123143620.10480-1-i.maximets@samsung.com> <20181123153920.12398-1-i.maximets@samsung.com> Subject: [dpdk-dev] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak 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, 23 Nov 2018 15:39:50 -0000 If rte_eal_iopl_init() will be called more than once we'll leak the file descriptor. Fixes: b46fe31862ec ("eal/bsd: fix virtio on FreeBSD") Cc: stable@dpdk.org Signed-off-by: Ilya Maximets --- lib/librte_eal/bsdapp/eal/eal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 508cbc46f..b8152a75c 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void) int rte_eal_iopl_init(void) { - static int fd; + static int fd = -1; + + if (fd < 0) + fd = open("/dev/io", O_RDWR); - fd = open("/dev/io", O_RDWR); if (fd < 0) return -1; /* keep fd open for iopl */ -- 2.17.1