Patch "tcp: add a missing nf_reset_ct() in 3WHS handling" has been added to the 5.10-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: add a missing nf_reset_ct() in 3WHS handling

to the 5.10-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-add-a-missing-nf_reset_ct-in-3whs-handling.patch
and it can be found in the queue-5.10 subdirectory.

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



commit da13b6ebf350c7a8ce1ba8bed9cb1e7ed158b07c
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Thu Jun 23 05:04:36 2022 +0000

    tcp: add a missing nf_reset_ct() in 3WHS handling
    
    [ Upstream commit 6f0012e35160cd08a53e46e3b3bbf724b92dfe68 ]
    
    When the third packet of 3WHS connection establishment
    contains payload, it is added into socket receive queue
    without the XFRM check and the drop of connection tracking
    context.
    
    This means that if the data is left unread in the socket
    receive queue, conntrack module can not be unloaded.
    
    As most applications usually reads the incoming data
    immediately after accept(), bug has been hiding for
    quite a long time.
    
    Commit 68822bdf76f1 ("net: generalize skb freeing
    deferral to per-cpu lists") exposed this bug because
    even if the application reads this data, the skb
    with nfct state could stay in a per-cpu cache for
    an arbitrary time, if said cpu no longer process RX softirqs.
    
    Many thanks to Ilya Maximets for reporting this issue,
    and for testing various patches:
    https://lore.kernel.org/netdev/20220619003919.394622-1-i.maximets@xxxxxxx/
    
    Note that I also added a missing xfrm4_policy_check() call,
    although this is probably not a big issue, as the SYN
    packet should have been dropped earlier.
    
    Fixes: b59c270104f0 ("[NETFILTER]: Keep conntrack reference until IPsec policy checks are done")
    Reported-by: Ilya Maximets <i.maximets@xxxxxxx>
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Cc: Florian Westphal <fw@xxxxxxxxx>
    Cc: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Cc: Steffen Klassert <steffen.klassert@xxxxxxxxxxx>
    Tested-by: Ilya Maximets <i.maximets@xxxxxxx>
    Reviewed-by: Ilya Maximets <i.maximets@xxxxxxx>
    Link: https://lore.kernel.org/r/20220623050436.1290307-1-edumazet@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 017cd666387f..aba5f3a7231b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1980,7 +1980,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
 		struct sock *nsk;
 
 		sk = req->rsk_listener;
-		if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))) {
+		if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif) ||
+				!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))) {
 			sk_drops_add(sk, skb);
 			reqsk_put(req);
 			goto discard_it;
@@ -2019,6 +2020,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
 			}
 			goto discard_and_relse;
 		}
+		nf_reset_ct(skb);
 		if (nsk == sk) {
 			reqsk_put(req);
 			tcp_v4_restore_cb(skb);



[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