Don't try to handle interrupts for a detached device. Should fix

panic on shutdown reported by Stefan Hertenberger on current-users.
This commit is contained in:
bouyer 2018-12-08 13:31:31 +00:00
parent e1f1a9870c
commit c0f69c43f3
1 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_msk.c,v 1.80 2018/11/13 19:39:04 jdolecek Exp $ */
/* $NetBSD: if_msk.c,v 1.81 2018/12/08 13:31:31 bouyer Exp $ */
/* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */
/*
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.80 2018/11/13 19:39:04 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.81 2018/12/08 13:31:31 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1299,7 +1299,7 @@ msk_detach(device_t self, int flags)
if (sc->sk_if[sc_if->sk_port] == NULL)
return (0);
msk_stop(ifp, 0);
msk_stop(ifp, 1);
if (--sc->rnd_attached == 0)
rnd_detach_source(&sc->rnd_source);
@ -2244,10 +2244,12 @@ msk_intr(void *xsc)
switch (cur_st->sk_opcode) {
case SK_Y2_STOPC_RXSTAT:
sc_if = sc->sk_if[cur_st->sk_link & 0x01];
msk_rxeof(sc_if, letoh16(cur_st->sk_len),
letoh32(cur_st->sk_status));
if (sc_if->sk_cdata.sk_rx_cnt < (MSK_RX_RING_CNT/3))
msk_fill_rx_tick(sc_if);
if (sc_if) {
msk_rxeof(sc_if, letoh16(cur_st->sk_len),
letoh32(cur_st->sk_status));
if (sc_if->sk_cdata.sk_rx_cnt < (MSK_RX_RING_CNT/3))
msk_fill_rx_tick(sc_if);
}
break;
case SK_Y2_STOPC_TXSTAT:
if (sc_if0)