Patch "ping: fix the sk_bound_dev_if match in ping_lookup" has been added to the 5.16-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

    ping: fix the sk_bound_dev_if match in ping_lookup

to the 5.16-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:
     ping-fix-the-sk_bound_dev_if-match-in-ping_lookup.patch
and it can be found in the queue-5.16 subdirectory.

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



commit 7ea79640ecacbb6e675c163ecebbbca410cf62ff
Author: Xin Long <lucien.xin@xxxxxxxxx>
Date:   Sat Jan 22 06:40:56 2022 -0500

    ping: fix the sk_bound_dev_if match in ping_lookup
    
    [ Upstream commit 2afc3b5a31f9edf3ef0f374f5d70610c79c93a42 ]
    
    When 'ping' changes to use PING socket instead of RAW socket by:
    
       # sysctl -w net.ipv4.ping_group_range="0 100"
    
    the selftests 'router_broadcast.sh' will fail, as such command
    
      # ip vrf exec vrf-h1 ping -I veth0 198.51.100.255 -b
    
    can't receive the response skb by the PING socket. It's caused by mismatch
    of sk_bound_dev_if and dif in ping_rcv() when looking up the PING socket,
    as dif is vrf-h1 if dif's master was set to vrf-h1.
    
    This patch is to fix this regression by also checking the sk_bound_dev_if
    against sdif so that the packets can stil be received even if the socket
    is not bound to the vrf device but to the real iif.
    
    Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
    Reported-by: Hangbin Liu <liuhangbin@xxxxxxxxx>
    Signed-off-by: Xin Long <lucien.xin@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 1e44a43acfe2d..086822cb1cc96 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -220,7 +220,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)
 			continue;
 		}
 
-		if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)
+		if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif &&
+		    sk->sk_bound_dev_if != inet_sdif(skb))
 			continue;
 
 		sock_hold(sk);



[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