]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r368237: if: Fix panic when destroying vnet and epair simultaneously
authorKristof Provost <kp@FreeBSD.org>
Mon, 18 Jan 2021 21:55:53 +0000 (16:55 -0500)
committerEd Maste <emaste@FreeBSD.org>
Fri, 29 Jan 2021 00:58:55 +0000 (19:58 -0500)
commite0c15f45abd4bd5165e11b557a8c90d0faf5cfeb
tree4a2b2f216436d6e593600850ee8cf3ba414f9a43
parentada9757963440309f07b448585d3ebce790dbec0
MFC r368237: if: Fix panic when destroying vnet and epair simultaneously

When destroying a vnet and an epair (with one end in the vnet) we often
panicked. This was the result of the destruction of the epair, which destroys
both ends simultaneously, happening while vnet_if_return() was moving the
struct ifnet to its home vnet. This can result in a freed ifnet being re-added
to the home vnet V_ifnet list. That in turn panics the next time the ifnet is
used.

Prevent this race by ensuring that vnet_if_return() cannot run at the same time
as if_detach() or epair_clone_destroy().

PR: 238870, 234985, 244703, 250870
Sponsored by: Modirum MDPay
Approved by: so
sys/net/if.c
sys/net/if_var.h