On Wed, Jul 04, 2018 at 08:18:53PM +0000, Moritz Buhl wrote:
> Removing my usb network interface during `tcpdump -i rum0` caused my
> kernel to crash. A fix is attached.

This error comes from the usbd_is_dying() check in the device ioctl.
Some drivers return EIO in this case.  I think ENXIO is better, so
let's add one special case here and make the drivers consistently
use ENXIO in a next step.

OK bluhm@

> Index: net/bpf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/bpf.c,v
> retrieving revision 1.169
> diff -u -p -r1.169 bpf.c
> --- net/bpf.c 2 Mar 2018 16:57:41 -0000       1.169
> +++ net/bpf.c 4 Jul 2018 19:42:35 -0000
> @@ -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

Reply via email to