diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-03-19 20:50:32 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-03-19 20:50:32 +0000 |
| commit | e1a7e1e1f8ff50be095ecb82bf7d3741c118fd29 (patch) | |
| tree | b53c8cf982948e9b5dcf5cd295b9680f84a704db /sys/dev | |
| parent | c93ed79498338784e83b6e6c3a3a5adf049721f6 (diff) | |
usb: Insert assertion to diagnose ud_cdesc/ud_ifaces inconsistency.
Syzbot found a way to see ud_cdesc=NULL but ud_ifaces!=NULL:
https://syzkaller.appspot.com/bug?id=e6d4449a128e73a9a88100a5cc833e5cae9fecae
Maybe it's a race with two threads somehow doing usbd_free_device at
the same time when only one should, but let's rule this case out
early on to make it easier to prove it has to be a race.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/usb_subr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 9a9f6c9c9ee..18c041c8664 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.274 2022/03/13 20:44:06 riastradh Exp $ */ +/* $NetBSD: usb_subr.c,v 1.275 2022/03/19 20:50:32 riastradh Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.274 2022/03/13 20:44:06 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.275 2022/03/19 20:50:32 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -905,6 +905,7 @@ bad: /* XXX Use usbd_set_config() to reset the config? */ /* XXX Should we forbid USB_UNCONFIG_NO from bConfigurationValue? */ dev->ud_config = USB_UNCONFIG_NO; + KASSERT(dev->ud_ifaces == NULL); kmem_free(cdp, len); dev->ud_cdesc = NULL; if (bdp != NULL) { |
