Module Name: src Committed By: yamaguchi Date: Fri Apr 16 02:23:25 UTC 2021
Modified Files: src/sys/net: if_pppoe.c Log Message: Stop and destroy timeout after sppp_detach and if_detach for safety The functions may use resources of pppoe(4) while detaching, so the release should move after it. To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_pppoe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_pppoe.c diff -u src/sys/net/if_pppoe.c:1.168 src/sys/net/if_pppoe.c:1.169 --- src/sys/net/if_pppoe.c:1.168 Fri Apr 16 02:12:00 2021 +++ src/sys/net/if_pppoe.c Fri Apr 16 02:23:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $ */ /* * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "pppoe.h" @@ -436,13 +436,18 @@ pppoe_clone_destroy(struct ifnet *ifp) } rw_exit(&pppoe_softc_list_lock); + bpf_detach(ifp); + sppp_detach(&sc->sc_sppp.pp_if); + if_detach(ifp); + callout_setfunc(&sc->sc_timeout, pppoe_timeout_co_halt, sc); + workqueue_wait(sc->sc_timeout_wq, &sc->sc_timeout_wk); + workqueue_destroy(sc->sc_timeout_wq); + callout_halt(&sc->sc_timeout, NULL); + callout_destroy(&sc->sc_timeout); - bpf_detach(ifp); - sppp_detach(&sc->sc_sppp.pp_if); - if_detach(ifp); if (sc->sc_concentrator_name) free(sc->sc_concentrator_name, M_DEVBUF); if (sc->sc_service_name) @@ -451,8 +456,6 @@ pppoe_clone_destroy(struct ifnet *ifp) free(sc->sc_ac_cookie, M_DEVBUF); if (sc->sc_relay_sid) free(sc->sc_relay_sid, M_DEVBUF); - callout_destroy(&sc->sc_timeout); - workqueue_destroy(sc->sc_timeout_wq); rw_destroy(&sc->sc_lock);