net/tap: fix fd leak on creation failure
authorYunjian Wang <wangyunjian@huawei.com>
Thu, 16 Apr 2020 03:04:56 +0000 (11:04 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:08 +0000 (13:57 +0200)
commitcbf8909b3aa16c2b1807bd980aad56d8d1e9362e
treeb8b6cb56d4475381d739f351eb73093979584a81
parentf9d5da4ab686b331c55bb98f43237d64ab820d0b
net/tap: fix fd leak on creation failure

When eth_dev_tap_create() is failed, nlsk_fd and ka_fd won't be closed
thus leading fds leak. Zero is a valid fd. Ultimately leads to a valid
fd was closed by mistake.

Fixes: bf7b7f437b49 ("net/tap: create netdevice during probing")
Fixes: cb7e68da630a ("net/tap: fix cleanup on allocation failure")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
drivers/net/tap/rte_eth_tap.c