git.droids-corp.org
/
dpdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8747682
)
eal/bsd: fix possible IOPL fd leak
author
Ilya Maximets
<i.maximets@samsung.com>
Fri, 23 Nov 2018 15:39:19 +0000
(18:39 +0300)
committer
Thomas Monjalon
<thomas@monjalon.net>
Sun, 25 Nov 2018 10:44:25 +0000
(11:44 +0100)
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 <i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_eal/bsdapp/eal/eal.c
patch
|
blob
|
history
diff --git
a/lib/librte_eal/bsdapp/eal/eal.c
b/lib/librte_eal/bsdapp/eal/eal.c
index
508cbc4
..
b8152a7
100644
(file)
--- 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 */