Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

inet: tcp: fix inetpeer_set_addr_v4()

David Ahern added a vif field in the a4 part of inetpeer_addr struct.

This broke IPv4 TCP fast open client side and more generally tcp metrics
cache, because inetpeer_addr_cmp() is now comparing two u32 instead of
one.

inetpeer_set_addr_v4() needs to properly init vif field, otherwise
the comparison result depends on uninitialized data.

Fixes: 192132b9a034 ("net: Add support for VRFs to inetpeer cache")
Reported-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
887dc9f2 9b29c696

+1
+1
include/net/inetpeer.h
··· 78 78 static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip) 79 79 { 80 80 iaddr->a4.addr = ip; 81 + iaddr->a4.vif = 0; 81 82 iaddr->family = AF_INET; 82 83 } 83 84