diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-06-26 21:35:53 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-06-26 21:35:53 +0000 |
| commit | b1bf11ebc734d6e60bb5df9f099732ebd41ca7f9 (patch) | |
| tree | e1ca3fc20b6109f74b85ffb845ea824d55c223c1 /sys/dev/usb | |
| parent | c6516901fe6e411552d346dd5913cbd22e79a633 (diff) | |
umcs(4): Reject invalid interrupt endpoints.
Reported-by: syzbot+cd1e60e112e840e40d0a@syzkaller.appspotmail.com
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/umcs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/usb/umcs.c b/sys/dev/usb/umcs.c index 4f07db04361..e5edca86576 100644 --- a/sys/dev/usb/umcs.c +++ b/sys/dev/usb/umcs.c @@ -1,4 +1,4 @@ -/* $NetBSD: umcs.c,v 1.19 2022/04/19 01:35:28 riastradh Exp $ */ +/* $NetBSD: umcs.c,v 1.20 2022/06/26 21:35:53 riastradh Exp $ */ /* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */ /*- @@ -41,7 +41,7 @@ * */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.19 2022/04/19 01:35:28 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.20 2022/06/26 21:35:53 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -276,6 +276,12 @@ umcs7840_attach(device_t parent, device_t self, void *aux) sc->sc_dying = true; return; } + if (sc->sc_intr_buflen == 0) { + aprint_error_dev(self, "invalid interrupt endpoint" + " (addr %d)\n", intr_addr); + sc->sc_dying = true; + return; + } sc->sc_intr_buf = kmem_alloc(sc->sc_intr_buflen, KM_SLEEP); error = usbd_open_pipe_intr(sc->sc_iface, intr_addr, |
