]> git.dujemihanovic.xyz Git - linux.git/commitdiff
selftests: mptcp: always close input's FD if opened
authorLiu Jing <liujing@cmss.chinamobile.com>
Sat, 27 Jul 2024 09:04:03 +0000 (11:04 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jul 2024 12:31:27 +0000 (13:31 +0100)
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: 05be5e273c84 ("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>
tools/testing/selftests/net/mptcp/mptcp_connect.c

index d2043ec3bf6d69d8d3aba159406ec6391b8e401f..4209b95690394b7565f330a37606bf39b6d2d228 100644 (file)
@@ -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;
 }