[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230519080118.25539-1-cambda@linux.alibaba.com>
Date: Fri, 19 May 2023 16:01:18 +0800
From: Cambda Zhu <cambda@...ux.alibaba.com>
To: netdev@...r.kernel.org
Cc: Eric Dumazet <edumazet@...gle.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Dust Li <dust.li@...ux.alibaba.com>,
Tony Lu <tonylu@...ux.alibaba.com>,
Cambda Zhu <cambda@...ux.alibaba.com>,
Jack Yang <mingliang@...ux.alibaba.com>
Subject: [PATCH net-next] net: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state
This patch removes the tp->mss_cache check in getting TCP_MAXSEG of
CLOSE/LISTEN sock. Checking if tp->mss_cache is zero is probably a bug,
since tp->mss_cache is initialized with TCP_MSS_DEFAULT. Getting
TCP_MAXSEG of sock in other state will still return tp->mss_cache.
Signed-off-by: Cambda Zhu <cambda@...ux.alibaba.com>
Reported-by: Jack Yang <mingliang@...ux.alibaba.com>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3d18e295bb2f..713854f1f061 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4083,7 +4083,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,
switch (optname) {
case TCP_MAXSEG:
val = tp->mss_cache;
- if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)))
+ if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))
val = tp->rx_opt.user_mss;
if (tp->repair)
val = tp->rx_opt.mss_clamp;
--
2.16.6
Powered by blists - more mailing lists