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
..
2019-10-17 21:33:01 +00:00
2019-10-17 21:33:01 +00:00
2019-12-21 21:01:03 +00:00
2021-01-29 21:43:20 +00:00
2020-12-29 17:35:06 +01:00
2021-01-29 21:43:20 +00:00
2021-02-11 16:12:29 +01:00
2020-11-20 14:45:45 +00:00
2020-10-16 11:22:29 +00:00
2020-11-08 19:02:22 +00:00
2021-02-11 16:12:29 +01:00