Patch "tcp_metrics: fix addr_same() helper" has been added to the 4.14-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_metrics: fix addr_same() helper

to the 4.14-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_metrics-fix-addr_same-helper.patch
and it can be found in the queue-4.14 subdirectory.

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



commit d3a54b6af57cbc2ecd6e340fa82bac828e639961
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Wed Aug 2 13:14:55 2023 +0000

    tcp_metrics: fix addr_same() helper
    
    [ Upstream commit e6638094d7af6c7b9dcca05ad009e79e31b4f670 ]
    
    Because v4 and v6 families use separate inetpeer trees (respectively
    net->ipv4.peers and net->ipv6.peers), inetpeer_addr_cmp(a, b) assumes
    a & b share the same family.
    
    tcp_metrics use a common hash table, where entries can have different
    families.
    
    We must therefore make sure to not call inetpeer_addr_cmp()
    if the families do not match.
    
    Fixes: d39d14ffa24c ("net: Add helper function to compare inetpeer addresses")
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230802131500.1478140-2-edumazet@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 0f0d740f6c8b9..34e3873b31946 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -80,7 +80,7 @@ static void tcp_metric_set(struct tcp_metrics_block *tm,
 static bool addr_same(const struct inetpeer_addr *a,
 		      const struct inetpeer_addr *b)
 {
-	return inetpeer_addr_cmp(a, b) == 0;
+	return (a->family == b->family) && !inetpeer_addr_cmp(a, b);
 }
 
 struct tcpm_hash_bucket {



[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