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

BugLink: https://bugs.launchpad.net/bugs/2083488

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: 05be5e273c ("selftests: mptcp: add disconnect tests")
Cc: stable@vger.kernel.org
Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
Liu Jing
2024-07-27 11:04:03 +02:00
committed by Mehmet Basaran
parent ab02d8bb0f
commit 9b70774507
@@ -1115,11 +1115,11 @@ again:
return 1;
}
if (--cfg_repeat > 0) {
if (cfg_input)
close(fd);
if (cfg_input)
close(fd);
if (--cfg_repeat > 0)
goto again;
}
return 0;
}