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:
6521c9a
)
net/tap: fix file descriptor leak on error
author
Stephen Hemminger
<stephen@networkplumber.org>
Tue, 6 Nov 2018 19:30:04 +0000
(11:30 -0800)
committer
Thomas Monjalon
<thomas@monjalon.net>
Wed, 14 Nov 2018 01:14:09 +0000
(
02:14
+0100)
If netlink socket setup fails the file descriptor was leaked.
Coverity issue: 257040
Fixes:
7c25284e30c2
("net/tap: add netlink back-end for flow API")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Keith Wiles <keith.wiles@intel.com>
drivers/net/tap/tap_netlink.c
patch
|
blob
|
history
diff --git
a/drivers/net/tap/tap_netlink.c
b/drivers/net/tap/tap_netlink.c
index
6cb5100
..
14bbbec
100644
(file)
--- a/
drivers/net/tap/tap_netlink.c
+++ b/
drivers/net/tap/tap_netlink.c
@@
-51,14
+51,17
@@
tap_nl_init(uint32_t nl_groups)
}
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf_size, sizeof(int))) {
TAP_LOG(ERR, "Unable to set socket buffer send size");
+ close(fd);
return -1;
}
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, sizeof(int))) {
TAP_LOG(ERR, "Unable to set socket buffer receive size");
+ close(fd);
return -1;
}
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
TAP_LOG(ERR, "Unable to bind to the netlink socket");
+ close(fd);
return -1;
}
return fd;