Commit eb8917b8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Yongqiang Liu
Browse files

tcp_metrics: fix addr_same() helper

stable inclusion
from stable-v4.19.291
commit 685e39a4a00aa58d00f877eb388d9ed24255bf24
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7ZELT


CVE: NA

--------------------------------

[ Upstream commit e6638094 ]

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: d39d14ff ("net: Add helper function to compare inetpeer addresses")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230802131500.1478140-2-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 2baedca6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment