In xennet_xenbus_detach(), remove the event handler early (just after
xennet_stop()) so that we don't get events while slepping (e.g. in softint_disestablish()) when some structures have already been freed. Problem reported and patch tested by Rohan Desai.
This commit is contained in:
parent
970a1b8e99
commit
f35e6799e0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_xennet_xenbus.c,v 1.66 2016/02/09 08:32:10 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_xennet_xenbus.c,v 1.67 2016/02/16 08:41:32 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -85,7 +85,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.66 2016/02/09 08:32:10 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.67 2016/02/16 08:41:32 bouyer Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include "opt_nfs_boot.h"
|
||||
@ -422,6 +422,7 @@ xennet_xenbus_detach(device_t self, int flags)
|
||||
DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
|
||||
s0 = splnet();
|
||||
xennet_stop(ifp, 1);
|
||||
event_remove_handler(sc->sc_evtchn, &xennet_handler, sc);
|
||||
/* wait for pending TX to complete, and collect pending RX packets */
|
||||
xennet_handler(sc);
|
||||
while (sc->sc_tx_ring.sring->rsp_prod != sc->sc_tx_ring.rsp_cons) {
|
||||
@ -457,7 +458,6 @@ xennet_xenbus_detach(device_t self, int flags)
|
||||
uvm_km_free(kernel_map, (vaddr_t)sc->sc_rx_ring.sring, PAGE_SIZE,
|
||||
UVM_KMF_WIRED);
|
||||
softint_disestablish(sc->sc_softintr);
|
||||
event_remove_handler(sc->sc_evtchn, &xennet_handler, sc);
|
||||
splx(s0);
|
||||
|
||||
pmf_device_deregister(self);
|
||||
|
Loading…
Reference in New Issue
Block a user