Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Fix NULL deref. Found by vHCI.



details:   https://anonhg.NetBSD.org/src/rev/1a0bd3a03f42
branches:  trunk
changeset: 1003415:1a0bd3a03f42
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Sep 14 15:22:31 2019 +0000

description:
Fix NULL deref. Found by vHCI.

diffstat:

 sys/dev/usb/usscanner.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 38015a693810 -r 1a0bd3a03f42 sys/dev/usb/usscanner.c
--- a/sys/dev/usb/usscanner.c   Sat Sep 14 15:21:19 2019 +0000
+++ b/sys/dev/usb/usscanner.c   Sat Sep 14 15:22:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usscanner.c,v 1.44 2019/05/05 03:17:54 mrg Exp $       */
+/*     $NetBSD: usscanner.c,v 1.45 2019/09/14 15:22:31 maxv Exp $      */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usscanner.c,v 1.44 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usscanner.c,v 1.45 2019/09/14 15:22:31 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -387,7 +387,9 @@
        else
                rv = 0;
 
-       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 rv;
 }



Home | Main Index | Thread Index | Old Index