From 273c5eebb1898b077ab2647196c09b22ebfed46e Mon Sep 17 00:00:00 2001 From: bluhm Date: Fri, 13 Jul 2018 08:51:15 +0000 Subject: [PATCH] Some USB network interfaces like rum(4) report ENXIO from their ioctl function after the device has been pulled out. Also accept this error code in bpf_detachd() to prevent a kernel panic. tcpdump(8) may run while the interface is detached. from Moritz Buhl; OK stsp@ --- sys/net/bpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index a6bcf31d471..d3cffa592c9 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.169 2018/03/02 16:57:41 bluhm Exp $ */ +/* $OpenBSD: bpf.c,v 1.170 2018/07/13 08:51:15 bluhm Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -332,7 +332,8 @@ bpf_detachd(struct bpf_d *d) mtx_enter(&d->bd_mtx); bpf_put(d); - if (error && !(error == EINVAL || error == ENODEV)) + if (error && !(error == EINVAL || error == ENODEV || + error == ENXIO)) /* * Something is really wrong if we were able to put * the driver into promiscuous mode, but can't -- 2.20.1