1 Star 0 Fork 43

陈亚强/spdk

forked from src-openEuler/spdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0008-nvmf-fix-fd-leakage-problem-in-nvmf_vfio_user_listen.patch 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
From 09b368248b3337e5d7fd0ff9c4b1ce4fb0827ea1 Mon Sep 17 00:00:00 2001
From: Zhiqiang Liu <[email protected]>
Date: Sun, 13 Jun 2021 20:12:17 +0800
Subject: [PATCH 25/28] nvmf: fix fd leakage problem in nvmf_vfio_user_listen()
In nvmf_vfio_user_listen(), fd should be closed before
set it to endpoint->fd, otherwise, the fd leakage probem
occurs.
Signed-off-by: Zhiqiang Liu <[email protected]>
Change-Id: I3fabc65d2764926e5873475962e4362e46eb37e4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8309
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <[email protected]>
Reviewed-by: sunshihao <[email protected]>
Reviewed-by: Aleksey Marchuk <[email protected]>
Tested-by: SPDK CI Jenkins <[email protected]>
---
lib/nvmf/vfio_user.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c
index f5daa8d..7ec980a 100644
--- a/lib/nvmf/vfio_user.c
+++ b/lib/nvmf/vfio_user.c
@@ -1662,6 +1662,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
}
free(path);
+ endpoint->fd = fd;
err = ftruncate(fd, NVMF_VFIO_USER_DOORBELLS_OFFSET + NVMF_VFIO_USER_DOORBELLS_SIZE);
if (err != 0) {
goto out;
@@ -1675,8 +1676,6 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
goto out;
}
- endpoint->fd = fd;
-
snprintf(uuid, PATH_MAX, "%s/cntrl", endpoint_id(endpoint));
SPDK_DEBUGLOG(nvmf_vfio, "%s: doorbells %p\n", uuid, endpoint->doorbells);
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yaqiangchen/spdk.git
[email protected]:yaqiangchen/spdk.git
yaqiangchen
spdk
spdk
master

搜索帮助