From 4f429be4c09a00ccc5cd13cfb14a11f90958ac74 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Sun, 26 Apr 2020 14:36:15 +0800 Subject: [PATCH] crypto/ccp: fix fd leak on probe failure Zero is a valid fd. When ccp_probe_device() is failed, the uio_fd won't be closed thus leading fd leak. Fixes: ef4b04f87fa6 ("crypto/ccp: support device init") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Ravi Kumar --- drivers/crypto/ccp/ccp_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp_dev.c b/drivers/crypto/ccp/ccp_dev.c index 80fe6a4533..7d98b2eb25 100644 --- a/drivers/crypto/ccp/ccp_dev.c +++ b/drivers/crypto/ccp/ccp_dev.c @@ -760,7 +760,7 @@ ccp_probe_device(const char *dirname, uint16_t domain, return 0; fail: CCP_LOG_ERR("CCP Device probe failed"); - if (uio_fd > 0) + if (uio_fd >= 0) close(uio_fd); if (ccp_dev) rte_free(ccp_dev); -- 2.20.1