Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/usb Pull up following revision(s) (requested by b...



details:   https://anonhg.NetBSD.org/src/rev/9c3e74fac571
branches:  netbsd-9
changeset: 843664:9c3e74fac571
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Dec 11 14:56:36 2019 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #544):

        sys/dev/usb/ugen.c: revision 1.148

reading usbdi.c it looks like usbd_get_config_descriptor() can actually
return NULL, so check for this.

I got NULL pointer dereference here with a device showing:
[   303.732632] ugen0: autoconfiguration error: setting configuration index 0 failed

diffstat:

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

diffs (27 lines):

diff -r 86338c21a560 -r 9c3e74fac571 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Wed Dec 11 14:54:47 2019 +0000
+++ b/sys/dev/usb/ugen.c        Wed Dec 11 14:56:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.146 2019/05/05 03:17:54 mrg Exp $   */
+/*     $NetBSD: ugen.c,v 1.146.2.1 2019/12/11 14:56:36 martin Exp $    */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.146 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.146.2.1 2019/12/11 14:56:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1406,6 +1406,8 @@
 
        if (index == USB_CURRENT_CONFIG_INDEX) {
                tdesc = usbd_get_config_descriptor(sc->sc_udev);
+               if (tdesc == NULL)
+                       return NULL;
                len = UGETW(tdesc->wTotalLength);
                if (lenp)
                        *lenp = len;



Home | Main Index | Thread Index | Old Index