linux/net
Eric Dumazet 331d846a71 ipv6: frags: cleanup __IP6_INC_STATS() confusion
After commits e1ae5c2ea4 ("vrf: Increment Icmp6InMsgs on the original
netdev") and bdb7cc643f ("ipv6: Count interface receive statistics
on the ingress netdev") net/ipv6/reassembly.c uses three different
ways to reach idev in various __IP6_INC_STATS() calls.

- ip6_dst_idev(skb_dst(skb))
- __in6_dev_get_safely(skb->dev)
- __in6_dev_stats_get(skb->dev)

Lets centralize this from ipv6_frag_rcv() and use __in6_dev_stats_get().

Note that ipv6_frag_rcv() tests if skb->dev could be NULL already, so
I chose to also guard against NULL, but we probably can remove the
tests in a followup patch, because I do not think skb->dev could be NULL.

iif = skb->dev ? skb->dev->ifindex : 0;

idev can be NULL, __IP6_INC_STATS() deals with this possibility.

Small code size reduction as a bonus.

$ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-145 (-145)
Function                                     old     new   delta
ipv6_frag_rcv                               2399    2362     -37
ip6_frag_reasm                               705     597    -108
Total: Before=31455552, After=31455407, chg -0.00%

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260526145529.3587126-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-27 17:27:26 -07:00
..
6lowpan
9p 9p/trans_xen: replace simple_strto* with kstrtouint 2026-04-16 02:57:01 +00:00
802 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
8021q 8021q: delete cleared egress QoS mappings 2026-04-23 12:13:57 +02:00
appletalk net: appletalk: fix NULL pointer dereference in aarp_send_ddp() 2026-05-18 16:33:34 -07:00
atm atm: convert to getsockopt_iter 2026-05-22 11:11:09 -07:00
batman-adv batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface 2026-05-19 10:43:54 +02:00
bluetooth Bluetooth: fix UAF in l2cap_sock_cleanup_listen() vs l2cap_conn_del() 2026-05-20 16:35:47 -04:00
bpf bpf: reject short IPv4/IPv6 inputs in bpf_prog_test_run_skb 2026-04-12 15:42:57 -07:00
bridge netfilter: add option for GCOV profiling 2026-05-24 22:55:47 +02:00
can Networking changes for 7.1. 2026-04-14 18:36:10 -07:00
ceph libceph: Fix potential null-ptr-deref in decode_choose_args() 2026-05-12 21:00:59 +02:00
core rtnetlink: add RTEXT_FILTER_NAME_ONLY support to rtnl_dump_ifinfo() 2026-05-26 19:20:15 -07:00
dcb Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
devlink devlink: pass param values by pointer 2026-05-25 14:03:06 -07:00
dns_resolver net/dns_resolver: consolidate namelen checks in dns_query 2026-05-27 17:00:44 -07:00
dsa net: dsa: add NETC switch tag support 2026-05-21 13:04:42 +02:00
ethernet bonding: prevent potential infinite loop in bond_header_parse() 2026-03-16 19:29:45 -07:00
ethtool net/ethtool: drop duplicate TSCONFIG HWTSTAMP BUILD_BUG_ON from SET handler 2026-05-19 15:15:12 +02:00
handshake treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
hsr net: hsr: require valid EOT supervision TLV 2026-05-26 18:41:05 -07:00
ieee802154 net: remove addr_len argument of recvmsg() handlers 2026-03-02 18:17:17 -08:00
ife
ipv4 netfilter pull request nf-next-26-05-25 2026-05-26 18:07:28 -07:00
ipv6 ipv6: frags: cleanup __IP6_INC_STATS() confusion 2026-05-27 17:27:26 -07:00
iucv af_iucv: convert to getsockopt_iter 2026-05-22 11:11:09 -07:00
kcm kcm: convert to getsockopt_iter 2026-05-10 10:11:08 -07:00
key vfs-7.1-rc1.kino 2026-04-13 12:19:01 -07:00
l2tp l2tp: ppp: convert to getsockopt_iter 2026-05-22 11:11:09 -07:00
l3mdev
lapb treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
llc llc: Add SPDX id lines to some llc source files 2026-05-26 17:26:57 -07:00
mac80211 Not much going on here right now: 2026-05-21 16:00:06 -07:00
mac802154 bonding: prevent potential infinite loop in bond_header_parse() 2026-03-16 19:29:45 -07:00
mctp mctp: convert to getsockopt_iter 2026-05-10 10:11:07 -07:00
mpls Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-02 11:03:13 -07:00
mptcp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-21 15:09:02 -07:00
ncsi net: ncsi: fix skb leak in error paths 2026-03-06 17:34:48 -08:00
netfilter netfilter: nf_conntrack_ftp: avoid u16 overflows 2026-05-25 20:00:04 +02:00
netlabel netlabel: fix IPv6 unlabeled address add error handling 2026-05-25 11:44:09 -07:00
netlink Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-14 10:08:06 -07:00
nfc NFC: digital: Bounds check NFC-A cascade depth in SDD response handler 2026-04-12 11:40:45 -07:00
nsh
openvswitch openvswitch: vport: fix race between linking and the device notifier 2026-05-18 16:38:45 -07:00
packet net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd() 2026-04-22 20:16:34 -07:00
phonet phonet/pep: disable BH around forwarded sk_receive_skb() 2026-05-21 07:38:21 -07:00
psample treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
psp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-07 11:19:07 -07:00
qrtr Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-14 12:04:00 -07:00
rds rds: filter RDS_INFO_* getsockopt by caller's netns 2026-05-25 12:18:42 -07:00
rfkill net: rfkill: prevent unlimited numbers of rfkill events from being created 2026-04-07 12:35:04 +02:00
rxrpc rxrpc: convert to getsockopt_iter 2026-05-22 11:11:10 -07:00
sched net/sched: sch_ets: make cl->quantum lockless 2026-05-25 11:09:27 -07:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-14 10:08:06 -07:00
shaper net: shaper: rework the VALID marking (again) 2026-05-20 16:34:20 -07:00
smc smc: Use flexible array for SMCD connections 2026-05-20 17:13:18 -07:00
strparser net: strparser: fix skb_head leak in strp_abort_strp() 2026-04-14 12:37:00 +02:00
sunrpc nfsd-7.1 fixes: 2026-05-15 13:11:41 -07:00
switchdev bridge: No DEV_PATH_BR_VLAN_UNTAG_HW for dsa foreign 2026-03-19 13:14:00 +01:00
tipc tipc: convert to getsockopt_iter 2026-05-22 11:11:10 -07:00
tls Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-21 15:09:02 -07:00
unix af_unix: Fix UAF read of tail->len in unix_stream_data_wait() 2026-05-19 18:53:56 -07:00
vmw_vsock Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-21 15:09:02 -07:00
wireless Not much going on here right now: 2026-05-21 16:00:06 -07:00
x25 x25: convert to getsockopt_iter 2026-05-10 10:11:08 -07:00
xdp xdp: convert to getsockopt_iter 2026-05-22 11:11:09 -07:00
xfrm xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete 2026-04-29 11:27:34 +02:00
compat.c
devres.c
Kconfig net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
Kconfig.debug
Makefile net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
socket.c net: socket: clean up __sys_accept4 comment 2026-05-19 19:22:41 -07:00
sysctl_net.c