Skip to content

Commit 7c70bcc

Browse files
Liu Jingdavem330
authored andcommitted
selftests: mptcp: always close input's FD if opened
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: 05be5e2 ("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>
1 parent 4a2f489 commit 7c70bcc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/testing/selftests/net/mptcp/mptcp_connect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,11 +1115,11 @@ int main_loop_s(int listensock)
11151115
return 1;
11161116
}
11171117

1118-
if (--cfg_repeat > 0) {
1119-
if (cfg_input)
1120-
close(fd);
1118+
if (cfg_input)
1119+
close(fd);
1120+
1121+
if (--cfg_repeat > 0)
11211122
goto again;
1122-
}
11231123

11241124
return 0;
11251125
}

0 commit comments

Comments
 (0)