freebsd-skq/sys
Tai-hwa Liang 092f3f0812 net: fixing a memory leak in if_deregister_com_alloc()
Drain the callbacks upon if_deregister_com_alloc() such that the
if_com_free[type] won't be nullified before if_destroy().

Taking fwip(4) as an example, before this fix, kldunload if_fwip will
go through the following:

  1. fwip_detach()
  2. if_free() -> schedule if_destroy() through NET_EPOCH_CALL
  3. fwip_detach() returns
  4. firewire_modevent(MOD_UNLOAD) -> if_deregister_com_alloc()
  5. kernel complains about:
	Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).
  6. EPOCH runs if_destroy() -> if_free_internal()i

By this time, if_com_free[if_alloctype] is NULL since it's already
nullified by if_deregister_com_alloc(); hence, firewire_free() won't
have a chance to release the allocated fw_com.

Reviewed by:	hselasky, glebius
MFC after:	2 weeks
2021-03-06 14:43:16 +00:00
..
amd64 Only set delayed inval for procs using PTI 2021-03-05 13:20:08 -06:00
arm arm64: Add support for bcm2838 RNG 2021-03-06 12:28:35 +01:00
arm64 sys/arm64/arm64/vfp.c: Fix -Wunused and -Wpointer-sign warnings 2021-03-04 18:25:44 +00:00
bsm Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
cam Do not exit ctl_be_block_worker() prematurely. 2021-03-05 22:45:47 -05:00
cddl Handle functions that use a nop in the arm64 fbt 2021-03-03 14:18:03 +00:00
compat Use atomic loads/stores when updating td->td_state 2021-02-18 14:02:48 +00:00
conf ice(4): Update to version 0.28.1-k 2021-03-05 17:33:39 -08:00
contrib zfs: merge OpenZFS master-bedbc13da 2021-03-03 02:15:33 +01:00
crypto ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 2021-03-03 15:20:57 -08:00
ddb ddb: just move cursor when the lexer backs up 2021-02-24 15:56:16 -08:00
dev ice(4): Update to version 0.28.1-k 2021-03-05 17:33:39 -08:00
dts Remove DTS files for arm boards we don't support 2021-01-27 10:02:01 +00:00
fs nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS 2021-03-02 14:18:23 -08:00
gdb Use atomic loads/stores when updating td->td_state 2021-02-18 14:02:48 +00:00
geom opencrypto: Introduce crypto_dispatch_async() 2021-02-08 09:19:19 -05:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 acpi: Make nexus_acpi quiet on amd64 and i386 2021-03-05 12:54:00 -05:00
isa
kern Implement mallocarray_domainset(9) variant of mallocarray(9). 2021-03-06 11:38:55 +01:00
kgssapi opencrypto: Introduce crypto_dispatch_async() 2021-02-08 09:19:19 -05:00
libkern Restore the augmented strlen commentary 2021-02-08 19:15:21 +00:00
mips [ar71xx] Fix routerstation / routerstation pro redboot FIS probing 2021-02-25 13:14:55 -08:00
modules ice(4): Update to version 0.28.1-k 2021-03-05 17:33:39 -08:00
net net: fixing a memory leak in if_deregister_com_alloc() 2021-03-06 14:43:16 +00:00
net80211 net80211: rx_stats add 160Mhz channel width. 2021-02-28 19:24:22 +00:00
netgraph netgraph/ng_bridge: Add counters for the first link, too 2021-02-10 19:05:37 +01:00
netinet tcp: Add prr_out in preparation for PRR/nonSACK and LRD 2021-03-06 00:38:22 +01:00
netinet6 net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros 2021-03-04 20:56:48 +01:00
netipsec Revert "SO_RERROR indicates that receive buffer overflows should be handled as errors." 2021-02-08 22:32:32 +00:00
netpfil net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros 2021-03-04 20:56:48 +01:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed ofed: quiet gcc -Wint-in-bool-context 2021-02-24 15:56:16 -08:00
opencrypto opencrypto: Make cryptosoft attach silently 2021-03-05 13:11:25 -05:00
powerpc [PowerPC64] add mpr to GENERIC64 and GENERIC64LE 2021-03-02 22:21:43 -03:00
riscv riscv: fix errors in some atomic type aliases 2021-03-04 16:59:58 -04:00
rpc nfs-over-tls: handle res.gid.gid_val correctly for memory allocation 2021-01-12 13:59:52 -08:00
security Add a comment on why the call to mac_vnode_relabel() might be in the wrong 2021-02-27 16:25:26 +00:00
sys Implement mallocarray_domainset(9) variant of mallocarray(9). 2021-03-06 11:38:55 +01:00
teken loader: implement framebuffer console 2021-01-02 21:41:36 +02:00
tests Enable running fib tests inside vnet jail. 2021-01-17 20:32:26 +00:00
tools syscalls.master: Add a new syscall type: RESERVED 2021-01-26 18:27:44 +00:00
ufs FFS extattr: fix handling of the tail 2021-03-02 02:19:34 +02:00
vm vm: Round up npages and alignment for contig reclamation 2021-03-02 10:21:02 -05:00
x86 smbios: Move smbios driver out from x86 machdep code 2021-02-23 21:17:09 +00:00
xdr
xen xen: remove .swp file from public headers 2021-01-11 18:14:11 +01:00
Makefile