]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r368237: if: Fix panic when destroying vnet and epair simultaneously
authorKristof Provost <kp@FreeBSD.org>
Sat, 12 Sep 2020 16:33:05 +0000 (16:33 +0000)
committerEd Maste <emaste@FreeBSD.org>
Fri, 29 Jan 2021 01:14:24 +0000 (20:14 -0500)
commite682b62c96e94c60d830e4414215032e0d4f8dad
tree47dfd652ab5d9af07d2a5c144596507360802bd4
parent13921409542c7f631f62d85b26cda0047121cb5a
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