1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Clear knlist before destroying it in tap(4) and tun(4). This fixes later

crash, when a kqueue descriptor tries to dereference appropriate knotes.

Approved by:	re (kib)
This commit is contained in:
Gleb Smirnoff 2013-10-02 20:44:36 +00:00
parent a5ff1d66de
commit c7063c15b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256008
2 changed files with 2 additions and 0 deletions

View File

@ -220,6 +220,7 @@ tap_destroy(struct tap_softc *tp)
CURVNET_SET(ifp->if_vnet);
destroy_dev(tp->tap_dev);
seldrain(&tp->tap_rsel);
knlist_clear(&tp->tap_rsel.si_note, 0);
knlist_destroy(&tp->tap_rsel.si_note);
ether_ifdetach(ifp);
if_free(ifp);

View File

@ -258,6 +258,7 @@ tun_destroy(struct tun_softc *tp)
if_free(TUN2IFP(tp));
destroy_dev(dev);
seldrain(&tp->tun_rsel);
knlist_clear(&tp->tun_rsel.si_note, 0);
knlist_destroy(&tp->tun_rsel.si_note);
mtx_destroy(&tp->tun_mtx);
cv_destroy(&tp->tun_cv);