freebsd-nq/sys
Ryan Stone 5adea417d4 Fix ifa refcount leak in ifa_ifwithnet()
In 4f6c66cc9c, ifa_ifwithnet() was changed to no longer
ifa_ref() the returned ifaddr, and instead the caller was required
to stay in the net_epoch for as long as they wanted the ifaddr
to remain valid.  However, this missed the case where an AF_LINK
lookup would call ifaddr_byindex(), which still does ifa_ref()
the ifaddr.  This would cause a refcount leak.

Fix this by inlining the relevant parts of ifaddr_byindex() here,
with the ifa_ref() call removed.  This also avoids an unnecessary
entry and exit from the net_epoch for this case.

I've audited all in-tree consumers of ifa_ifwithnet() that could
possibly perform an AF_LINK lookup and confirmed that none of them
will expect the ifaddr to have a reference that they need to
release.

MFC after: 2 months
Sponsored by: Dell Inc
Differential Revision:	https://reviews.freebsd.org/D28705
Reviewed by: melifaro
2022-01-06 15:04:24 -05:00
..
amd64 lio: remove from NOIP 2022-01-05 14:19:34 -07:00
arm bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
arm64 bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
bsm
cam iscsi: Pass the request PDU to icl_conn_transfer_setup(). 2022-01-04 14:37:17 -08:00
cddl dtrace: Use C99 fixed-width integer types. 2021-12-28 09:41:25 -08:00
compat exec: Simplify sv_copyout_strings implementations a bit 2021-12-31 12:50:15 -05:00
conf Add driver for marvell, a37x0 peripheral clocks 2022-01-04 13:26:35 +01:00
contrib iwlwifi: import correct firmware versions for select Intel iwlwifi/mvm 2021-12-31 11:51:18 +00:00
crypto sys/crypto: Use C99 fixed-width integer types. 2021-12-28 09:41:38 -08:00
ddb sys/ddb: Use C99 fixed-width integer types. 2021-12-28 09:41:47 -08:00
dev ocs_fc: Remove giant lock usage in sysctl. 2022-01-06 14:13:06 +05:30
dts add rk3328 overlay for enabling analog sound 2021-11-13 11:09:23 +02:00
fs unionfs: implement VOP_SET_TEXT/VOP_UNSET_TEXT 2022-01-02 19:52:58 -08:00
gdb
geom geom_gate: ensure readprov is null-terminated 2022-01-02 18:01:23 -07:00
gnu
i386 Silent some warnings for i386 kernel build 2022-01-06 07:53:04 +02:00
isa sys/isa: Use C99 fixed-width integer types. 2021-12-28 09:41:57 -08:00
kern bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
kgssapi
libkern sys/libkern: Use C99 fixed-width integer types. 2021-12-28 09:42:11 -08:00
modules neta: need clknode_if.h 2022-01-04 16:01:14 -07:00
net Fix ifa refcount leak in ifa_ifwithnet() 2022-01-06 15:04:24 -05:00
net80211 net80211: adjust a printf to toeee80211_note 2021-12-26 17:26:58 +00:00
netgraph domains: make domain_init() initialize only global state 2022-01-03 10:15:22 -08:00
netinet sctp: miror change due to upstreaming 2022-01-03 23:03:06 +01:00
netinet6 domains: make domain_init() initialize only global state 2022-01-03 10:15:22 -08:00
netipsec netipsec: use SYSINIT(9) instead of dom_init/dom_destroy 2022-01-03 10:15:21 -08:00
netpfil ipfilter module: Style(9) requires a space after return 2022-01-03 18:46:49 -08:00
netsmb
nfs nfs: don't truncate directory cookies to 32-bits in the NFS server 2021-12-15 20:54:57 -07:00
nfsclient
nfsserver
nlm sys/nlm: Use C99 fixed-width integer types. 2021-12-28 09:42:42 -08:00
ofed domains: init with standard SYSINIT(9) or VNET_SYSINIT() 2022-01-03 10:15:22 -08:00
opencrypto OCF: Add crypto_clonereq(). 2022-01-04 14:22:12 -08:00
powerpc bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
riscv bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
rpc sys/rpc: Use C99 fixed-width integer types. 2021-12-28 09:43:15 -08:00
security Thread creation privilege for realtime group 2021-12-15 00:01:58 +02:00
sys link_elf.h: cleanup struct link_map definition, remove mips-specific field 2022-01-06 06:14:17 +02:00
teken
tests
tools arm64: Don't rely on host readelf for u-boot booti image generation 2021-12-24 19:25:20 +00:00
ufs When doing a read-only mount of a UFS filesystem using gjournal(8), 2022-01-02 14:04:39 -08:00
vm Dump page tracking no longer needed on mips 2022-01-06 06:00:39 +02:00
x86 bus_dma: Deduplicate locking helper functions. 2022-01-05 13:50:40 -08:00
xdr sys/xdr: Use C99 fixed-width integer types. 2021-12-28 09:43:26 -08:00
xen Create wrapper for Giant taken for newbus 2021-12-09 17:04:45 -07:00
Makefile