Patch "tcp: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state if user_mss set" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tcp: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state if user_mss set

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tcp-return-user_mss-for-tcp_maxseg-in-close-listen-s.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 023f8be6a04f25f46a0c2a31a1cf593bfa8f9d54
Author: Cambda Zhu <cambda@xxxxxxxxxxxxxxxxx>
Date:   Sat May 27 12:03:17 2023 +0800

    tcp: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state if user_mss set
    
    [ Upstream commit 34dfde4ad87b84d21278a7e19d92b5b2c68e6c4d ]
    
    This patch replaces the tp->mss_cache check in getting TCP_MAXSEG
    with tp->rx_opt.user_mss check for CLOSE/LISTEN sock. Since
    tp->mss_cache is initialized with TCP_MSS_DEFAULT, checking if
    it's zero is probably a bug.
    
    With this change, getting TCP_MAXSEG before connecting will return
    default MSS normally, and return user_mss if user_mss is set.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Jack Yang <mingliang@xxxxxxxxxxxxxxxxx>
    Suggested-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Link: https://lore.kernel.org/netdev/CANn89i+3kL9pYtkxkwxwNMzvC_w3LNUum_2=3u+UyLBmGmifHA@xxxxxxxxxxxxxx/#t
    Signed-off-by: Cambda Zhu <cambda@xxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/netdev/14D45862-36EA-4076-974C-EA67513C92F6@xxxxxxxxxxxxxxxxx/
    Reviewed-by: Jason Xing <kerneljasonxing@xxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230527040317.68247-1-cambda@xxxxxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e427eabc7f278..fdf2ddc4864df 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3451,7 +3451,8 @@ static 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 (tp->rx_opt.user_mss &&
+		    ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)))
 			val = tp->rx_opt.user_mss;
 		if (tp->repair)
 			val = tp->rx_opt.mss_clamp;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux