Module Name: src
Committed By: maxv
Date: Sat Jun 27 07:29:11 UTC 2020
Modified Files:
src/sys/dev/usb: ulpt.c
Log Message:
Fix NULL deref on attach failure. Found via vHCI fuzzing.
Reported-by: [email protected]
To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/usb/ulpt.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/ulpt.c
diff -u src/sys/dev/usb/ulpt.c:1.106 src/sys/dev/usb/ulpt.c:1.107
--- src/sys/dev/usb/ulpt.c:1.106 Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/ulpt.c Sat Jun 27 07:29:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ulpt.c,v 1.106 2020/03/14 02:35:33 christos Exp $ */
+/* $NetBSD: ulpt.c,v 1.107 2020/06/27 07:29:11 maxv Exp $ */
/*
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.106 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.107 2020/06/27 07:29:11 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -374,7 +374,9 @@ ulpt_detach(device_t self, int flags)
vdevgone(maj, mn, mn, VCHR);
vdevgone(maj, mn | ULPT_NOPRIME , mn | ULPT_NOPRIME, VCHR);
- usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
+ if (sc->sc_udev != NULL)
+ usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
+ sc->sc_dev);
return 0;
}