]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mptcp: sockopt: drop redundant tcp_getsockopt
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 18 Jul 2025 22:06:56 +0000 (00:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 22 Jul 2025 00:48:32 +0000 (17:48 -0700)
tcp_getsockopt() is called twice in mptcp_getsockopt_first_sf_only() in
different conditions, which makes the code a bit redundant.

The first call to tcp_getsockopt() when the first subflow exists can be
replaced by going to a new label "get" before the second call.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250719-net-next-mptcp-tcp_maxseg-v2-1-8c910fbc5307@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/sockopt.c

index 3caa0a9d3b3885ce6399570f2d98a2e8f103638d..afa54fba51e215bc2efb21f16ed7d0a0fb120972 100644 (file)
@@ -914,10 +914,8 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int
 
        lock_sock(sk);
        ssk = msk->first;
-       if (ssk) {
-               ret = tcp_getsockopt(ssk, level, optname, optval, optlen);
-               goto out;
-       }
+       if (ssk)
+               goto get;
 
        ssk = __mptcp_nmpc_sk(msk);
        if (IS_ERR(ssk)) {
@@ -925,6 +923,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int
                goto out;
        }
 
+get:
        ret = tcp_getsockopt(ssk, level, optname, optval, optlen);
 
 out: