Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Don't crash with a division by zero if a bContro...



details:   https://anonhg.NetBSD.org/src/rev/9bdea5c50e21
branches:  trunk
changeset: 805999:9bdea5c50e21
user:      gson <gson%NetBSD.org@localhost>
date:      Mon Jan 26 20:37:44 2015 +0000

description:
Don't crash with a division by zero if a bControlSize field is 0.

diffstat:

 sys/dev/usb/uaudio.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r de3df8e66f10 -r 9bdea5c50e21 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Mon Jan 26 20:32:17 2015 +0000
+++ b/sys/dev/usb/uaudio.c      Mon Jan 26 20:37:44 2015 +0000
@@ -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 @@
        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 */



Home | Main Index | Thread Index | Old Index