Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb reading usbdi.c it looks like usbd_get_config_de...
details: https://anonhg.NetBSD.org/src/rev/906d8da68ccc
branches: trunk
changeset: 466081:906d8da68ccc
user: bouyer <bouyer%NetBSD.org@localhost>
date: Wed Dec 11 11:54:23 2019 +0000
description:
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 857dbe2f3a4d -r 906d8da68ccc sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Wed Dec 11 10:28:19 2019 +0000
+++ b/sys/dev/usb/ugen.c Wed Dec 11 11:54:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.147 2019/12/01 08:27:54 maxv Exp $ */
+/* $NetBSD: ugen.c,v 1.148 2019/12/11 11:54:23 bouyer 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.147 2019/12/01 08:27:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.148 2019/12/11 11:54:23 bouyer 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