Commit ad6db833 authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

mountns: potential fd leak when readlinkat call

when mntns_collect_root->readlinkat call faild, we should close pdf
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7071d520
...@@ -787,8 +787,10 @@ int mntns_collect_root(pid_t pid) ...@@ -787,8 +787,10 @@ int mntns_collect_root(pid_t pid)
pfd = open_pid_proc(pid); pfd = open_pid_proc(pid);
ret = readlinkat(pfd, "root", path, sizeof(path) - 1); ret = readlinkat(pfd, "root", path, sizeof(path) - 1);
if (ret < 0) if (ret < 0){
close_pid_proc();
return ret; return ret;
}
path[ret] = '\0'; path[ret] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment