Module Name: src Committed By: gson Date: Mon Jan 26 20:37:44 UTC 2015
Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't crash with a division by zero if a bControlSize field is 0. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.142 src/sys/dev/usb/uaudio.c:1.143 --- src/sys/dev/usb/uaudio.c:1.142 Mon Jan 26 20:32:17 2015 +++ src/sys/dev/usb/uaudio.c Mon Jan 26 20:37:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.142 2015/01/26 20:32:17 gson Exp $ */ +/* $NetBSD: uaudio.c,v 1.143 2015/01/26 20:37:44 gson Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.142 2015/01/26 20:32:17 gson Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.143 2015/01/26 20:37:44 gson Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1122,6 +1122,10 @@ uaudio_add_feature(struct uaudio_softc * d = iot[id].d.fu; ctls = d->bmaControls; ctlsize = d->bControlSize; + if (ctlsize == 0) { + DPRINTF("ignoring feature %d with controlSize of zero\n", id); + return; + } nchan = (d->bLength - 7) / ctlsize; mmask = GET(0); /* Figure out what we can control */