Module Name: src Committed By: riastradh Date: Sat Mar 12 18:31:39 UTC 2022
Modified Files: src/sys/dev/usb: emdtv.c Log Message: emdtv(4): If register read fails, read as all zero. Avoids undefined behaviour if device is yanked or broken. Reported-by: syzbot+18ce1e017b9f802ed...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/usb/emdtv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/emdtv.c diff -u src/sys/dev/usb/emdtv.c:1.15 src/sys/dev/usb/emdtv.c:1.16 --- src/sys/dev/usb/emdtv.c:1.15 Sat Mar 14 02:35:33 2020 +++ src/sys/dev/usb/emdtv.c Sat Mar 12 18:31:39 2022 @@ -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 <jmcne...@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 *s 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;