Patch "geneve: do not modify the shared tunnel info when PMTU triggers an ICMP reply" has been added to the 5.11-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

    geneve: do not modify the shared tunnel info when PMTU triggers an ICMP reply

to the 5.11-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:
     geneve-do-not-modify-the-shared-tunnel-info-when-pmt.patch
and it can be found in the queue-5.11 subdirectory.

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



commit 2ee370f382190bc45efadbce93fbf1358ab38264
Author: Antoine Tenart <atenart@xxxxxxxxxx>
Date:   Thu Mar 25 16:35:33 2021 +0100

    geneve: do not modify the shared tunnel info when PMTU triggers an ICMP reply
    
    [ Upstream commit 68c1a943ef37bafde5ea2383e8ca224c7169ee31 ]
    
    When the interface is part of a bridge or an Open vSwitch port and a
    packet exceed a PMTU estimate, an ICMP reply is sent to the sender. When
    using the external mode (collect metadata) the source and destination
    addresses are reversed, so that Open vSwitch can match the packet
    against an existing (reverse) flow.
    
    But inverting the source and destination addresses in the shared
    ip_tunnel_info will make following packets of the flow to use a wrong
    destination address (packets will be tunnelled to itself), if the flow
    isn't updated. Which happens with Open vSwitch, until the flow times
    out.
    
    Fixes this by uncloning the skb's ip_tunnel_info before inverting its
    source and destination addresses, so that the modification will only be
    made for the PTMU packet, not the following ones.
    
    Fixes: c1a800e88dbf ("geneve: Support for PMTU discovery on directly bridged links")
    Tested-by: Eelco Chaudron <echaudro@xxxxxxxxxx>
    Reviewed-by: Eelco Chaudron <echaudro@xxxxxxxxxx>
    Signed-off-by: Antoine Tenart <atenart@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 5523f069b9a5..f35b0b83fe85 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -908,8 +908,16 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 
 		info = skb_tunnel_info(skb);
 		if (info) {
-			info->key.u.ipv4.dst = fl4.saddr;
-			info->key.u.ipv4.src = fl4.daddr;
+			struct ip_tunnel_info *unclone;
+
+			unclone = skb_tunnel_info_unclone(skb);
+			if (unlikely(!unclone)) {
+				dst_release(&rt->dst);
+				return -ENOMEM;
+			}
+
+			unclone->key.u.ipv4.dst = fl4.saddr;
+			unclone->key.u.ipv4.src = fl4.daddr;
 		}
 
 		if (!pskb_may_pull(skb, ETH_HLEN)) {
@@ -993,8 +1001,16 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 		struct ip_tunnel_info *info = skb_tunnel_info(skb);
 
 		if (info) {
-			info->key.u.ipv6.dst = fl6.saddr;
-			info->key.u.ipv6.src = fl6.daddr;
+			struct ip_tunnel_info *unclone;
+
+			unclone = skb_tunnel_info_unclone(skb);
+			if (unlikely(!unclone)) {
+				dst_release(dst);
+				return -ENOMEM;
+			}
+
+			unclone->key.u.ipv6.dst = fl6.saddr;
+			unclone->key.u.ipv6.src = fl6.daddr;
 		}
 
 		if (!pskb_may_pull(skb, ETH_HLEN)) {



[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