diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-03-12 18:31:39 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-03-12 18:31:39 +0000 |
| commit | e377a775995aef32aee6c6d0aee921e07d17f2e4 (patch) | |
| tree | a8ec5c1915ee3e7e0c80dd25637268a168a70236 /sys/dev | |
| parent | 43695d47669a1ccf0926215476a7107b9cb32bcb (diff) | |
emdtv(4): If register read fails, read as all zero.
Avoids undefined behaviour if device is yanked or broken.
Reported-by: syzbot+18ce1e017b9f802ed287@syzkaller.appspotmail.com
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/emdtv.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/usb/emdtv.c b/sys/dev/usb/emdtv.c index bbc75495226..f0455ed8437 100644 --- a/sys/dev/usb/emdtv.c +++ b/sys/dev/usb/emdtv.c @@ -1,4 +1,4 @@ -/* $NetBSD: emdtv.c,v 1.15 2020/03/14 02:35:33 christos Exp $ */ +/* $NetBSD: emdtv.c,v 1.16 2022/03/12 18:31:39 riastradh Exp $ */ /*- * Copyright (c) 2008, 2011 Jared D. McNeill <jmcneill@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: emdtv.c,v 1.15 2020/03/14 02:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emdtv.c,v 1.16 2022/03/12 18:31:39 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -326,9 +326,11 @@ emdtv_read_multi_1(struct emdtv_softc *sc, uint8_t req, uint16_t index, status = usbd_do_request(sc->sc_udev, &request, datap); KERNEL_UNLOCK_ONE(curlwp); - if (status != USBD_NORMAL_COMPLETION) + if (status != USBD_NORMAL_COMPLETION) { aprint_error_dev(sc->sc_dev, "couldn't read %x/%x: %s\n", req, index, usbd_errstr(status)); + memset(datap, 0, count); + } if (emdtv_debug_regs) { int i; |
