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

Configure Feed

Select the types of activity you want to include in your feed.

ipv6: inet6_csk_xmit() and inet6_csk_update_pmtu() use inet->cork.fl.u.ip6

Convert inet6_csk_route_socket() to use np->final instead of an
automatic variable to get rid of a stack canary.

Convert inet6_csk_xmit() and inet6_csk_update_pmtu() to use
inet->cork.fl.u.ip6 instead of @fl6 automatic variable.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260206173426.1638518-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
969a2019 4e6c91cf

+11 -9
+11 -9
net/ipv6/inet6_connection_sock.c
··· 60 60 { 61 61 struct inet_sock *inet = inet_sk(sk); 62 62 struct ipv6_pinfo *np = inet6_sk(sk); 63 - struct in6_addr *final_p, final; 63 + struct in6_addr *final_p; 64 64 struct dst_entry *dst; 65 65 66 66 memset(fl6, 0, sizeof(*fl6)); ··· 77 77 security_sk_classify_flow(sk, flowi6_to_flowi_common(fl6)); 78 78 79 79 rcu_read_lock(); 80 - final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); 80 + final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &np->final); 81 81 rcu_read_unlock(); 82 82 83 83 dst = __sk_dst_check(sk, np->dst_cookie); ··· 92 92 93 93 int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused) 94 94 { 95 + struct flowi6 *fl6 = &inet_sk(sk)->cork.fl.u.ip6; 95 96 struct ipv6_pinfo *np = inet6_sk(sk); 96 - struct flowi6 fl6; 97 97 struct dst_entry *dst; 98 98 int res; 99 99 100 - dst = inet6_csk_route_socket(sk, &fl6); 100 + dst = inet6_csk_route_socket(sk, fl6); 101 101 if (IS_ERR(dst)) { 102 102 WRITE_ONCE(sk->sk_err_soft, -PTR_ERR(dst)); 103 103 sk->sk_route_caps = 0; ··· 109 109 skb_dst_set_noref(skb, dst); 110 110 111 111 /* Restore final destination back after routing done */ 112 - fl6.daddr = sk->sk_v6_daddr; 112 + fl6->daddr = sk->sk_v6_daddr; 113 113 114 - res = ip6_xmit(sk, skb, &fl6, sk->sk_mark, rcu_dereference(np->opt), 114 + res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt), 115 115 np->tclass, READ_ONCE(sk->sk_priority)); 116 116 rcu_read_unlock(); 117 117 return res; ··· 120 120 121 121 struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu) 122 122 { 123 - struct flowi6 fl6; 124 - struct dst_entry *dst = inet6_csk_route_socket(sk, &fl6); 123 + struct flowi6 *fl6 = &inet_sk(sk)->cork.fl.u.ip6; 124 + struct dst_entry *dst; 125 + 126 + dst = inet6_csk_route_socket(sk, fl6); 125 127 126 128 if (IS_ERR(dst)) 127 129 return NULL; 128 130 dst->ops->update_pmtu(dst, sk, NULL, mtu, true); 129 131 130 - dst = inet6_csk_route_socket(sk, &fl6); 132 + dst = inet6_csk_route_socket(sk, fl6); 131 133 return IS_ERR(dst) ? NULL : dst; 132 134 }