HomeFreeBSD

MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

Description

MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

(Commit massaged to match stable structure; tun and tap have been merged in
head)

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

Approved by: re (kib)

Details

Provenance
kevansAuthored on
Parents
rS348125: MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
Branches
Unknown
Tags
Unknown