linux-yocto/net/ipv6
Florian Westphal 7b8b503c06 netfilter: nf_reject: don't leak dst refcount for loopback packets
[ Upstream commit 91a79b792204313153e1bdbbe5acbfc28903b3a5 ]

recent patches to add a WARN() when replacing skb dst entry found an
old bug:

WARNING: include/linux/skbuff.h:1165 skb_dst_check_unset include/linux/skbuff.h:1164 [inline]
WARNING: include/linux/skbuff.h:1165 skb_dst_set include/linux/skbuff.h:1210 [inline]
WARNING: include/linux/skbuff.h:1165 nf_reject_fill_skb_dst+0x2a4/0x330 net/ipv4/netfilter/nf_reject_ipv4.c:234
[..]
Call Trace:
 nf_send_unreach+0x17b/0x6e0 net/ipv4/netfilter/nf_reject_ipv4.c:325
 nft_reject_inet_eval+0x4bc/0x690 net/netfilter/nft_reject_inet.c:27
 expr_call_ops_eval net/netfilter/nf_tables_core.c:237 [inline]
 ..

This is because blamed commit forgot about loopback packets.
Such packets already have a dst_entry attached, even at PRE_ROUTING stage.

Instead of checking hook just check if the skb already has a route
attached to it.

Fixes: f53b9b0bdc ("netfilter: introduce support for reject at prerouting stage")
Signed-off-by: Florian Westphal <fw@strlen.de>
Link: https://patch.msgid.link/20250820123707.10671-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:22:59 +02:00
..
ila net: Fix checksum update for ILA adj-transport 2025-06-27 11:04:24 +01:00
netfilter netfilter: nf_reject: don't leak dst refcount for loopback packets 2025-08-28 16:22:59 +02:00
addrconf_core.c ipv6: Ensure natural alignment of const ipv6 loopback and router addresses 2024-02-23 08:42:17 +01:00
addrconf.c ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS 2025-04-10 14:31:00 +02:00
addrlabel.c
af_inet6.c net: inet6: do not leave a dangling sk pointer in inet6_create() 2024-12-14 19:48:27 +01:00
ah6.c
anycast.c
calipso.c calipso: Fix null-ptr-deref in calipso_req_{set,del}attr(). 2025-06-27 11:04:22 +01:00
datagram.c
esp6_offload.c
esp6.c net: esp: cleanup esp_output_tail_tcp() in case of unsupported ESPINTCP 2024-08-19 05:40:44 +02:00
exthdrs_core.c
exthdrs_offload.c
exthdrs.c
fib6_notifier.c
fib6_rules.c ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). 2025-06-04 14:37:05 +02:00
fou6.c
icmp.c
inet6_connection_sock.c
inet6_hashtables.c net: remove duplicate reuseport_lookup functions 2024-06-16 13:32:06 +02:00
ip6_checksum.c
ip6_fib.c ipv6: fix possible race in __fib6_drop_pcpu_from() 2024-07-05 09:12:23 +02:00
ip6_flowlabel.c
ip6_gre.c erspan: make sure erspan_base_hdr is present in skb->head 2024-04-13 12:59:27 +02:00
ip6_icmp.c
ip6_input.c ipv6: annotate data-races around cnf.disable_ipv6 2024-07-18 13:05:50 +02:00
ip6_offload.c ipv6: reject malicious packets in ipv6_gso_segment() 2025-08-28 16:22:37 +02:00
ip6_offload.h
ip6_output.c Revert "ipv6: save dontfrag in cork" 2025-07-17 18:27:44 +02:00
ip6_tunnel.c ip6_tunnel: Fix broken GRO 2024-09-04 13:17:40 +02:00
ip6_udp_tunnel.c
ip6_vti.c
ip6mr.c ipmr: convert /proc handlers to rcu_read_lock() 2024-12-14 19:48:05 +01:00
ipcomp6.c
ipv6_sockglue.c tcp: Fix data races around icsk->icsk_af_ops. 2024-07-05 09:12:56 +02:00
Kconfig net: ipv6: select DST_CACHE from IPV6_RPL_LWTUNNEL 2024-10-17 15:07:57 +02:00
Makefile
mcast_snoop.c
mcast.c
mip6.c
ndisc.c ndisc: extend RCU protection in ndisc_send_skb() 2025-03-13 12:47:22 +01:00
netfilter.c netfilter: bridge: Move specific fragmented packet to slow_path instead of dropping it 2025-06-27 11:04:03 +01:00
output_core.c
ping.c
proc.c
protocol.c
raw.c
reassembly.c net: ipv6: fix wrong start position when receive hop-by-hop fragment 2024-06-16 13:32:09 +02:00
route.c ipv6: Set errno after ip_fib_metrics_init() in ip6_route_info_create(). 2025-04-10 14:30:53 +02:00
rpl_iptunnel.c rpl: Fix use-after-free in rpl_do_srh_inline(). 2025-08-28 16:22:28 +02:00
rpl.c
seg6_hmac.c ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add 2025-08-28 16:22:59 +02:00
seg6_iptunnel.c net: ipv6: fix dst refleaks in rpl, seg6 and ioam6 lwtunnels 2025-03-13 12:47:45 +01:00
seg6_local.c net: seg6: fix seg6_lookup_any_nexthop() to handle VRFs using flowi_l3mdev 2024-10-17 15:08:38 +02:00
seg6.c ipv6: sr: fix invalid unregister error path 2024-06-16 13:32:10 +02:00
sit.c
syncookies.c
sysctl_net_ipv6.c
tcp_ipv6.c net: fix data-races around sk->sk_forward_alloc 2025-02-01 18:22:31 +01:00
tcpv6_offload.c
tunnel6.c
udp_impl.h
udp_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_receive handlers 2024-09-12 11:06:47 +02:00
udp.c udp: gso: do not drop small packets when PMTU reduces 2025-03-13 12:47:04 +01:00
udplite.c
xfrm6_input.c xfrm: Preserve vlan tags for transport mode software GRO 2024-05-17 11:48:06 +02:00
xfrm6_output.c
xfrm6_policy.c xfrm: respect ip protocols rules criteria when performing dst lookups 2024-11-08 16:21:59 +01:00
xfrm6_protocol.c
xfrm6_state.c
xfrm6_tunnel.c