Commit 30a7ce91 authored by Liu Jing's avatar Liu Jing Committed by ZhangPeng
Browse files

selftests: mptcp: always close input's FD if opened

stable inclusion
from stable-v6.6.45
commit ffe8c864c89f5fb5488d2115e3724c7af86f075c
bugzilla: https://gitee.com/openeuler/kernel/issues/IAJEIR

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ffe8c864c89f5fb5488d2115e3724c7af86f075c



--------------------------------

commit 7c70bcc2a84cf925f655ea1ac4b8088062b144a3 upstream.

In main_loop_s function, when the open(cfg_input, O_RDONLY) function is
run, the last fd is not closed if the "--cfg_repeat > 0" branch is not
taken.

Fixes: 05be5e27 ("selftests: mptcp: add disconnect tests")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarLiu Jing <liujing@cmss.chinamobile.com>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 216c3687
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1115,11 +1115,11 @@ int main_loop_s(int listensock)
		return 1;
	}

	if (--cfg_repeat > 0) {
	if (cfg_input)
		close(fd);

	if (--cfg_repeat > 0)
		goto again;
	}

	return 0;
}