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 on attach failure. Found via vHCI...



details:   https://anonhg.NetBSD.org/src/rev/0f1981120261
branches:  trunk
changeset: 973318:0f1981120261
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jun 27 07:29:11 2020 +0000

description:
Fix NULL deref on attach failure. Found via vHCI fuzzing.

Reported-by: syzbot+9fdcdc21799e5d6d75ee%syzkaller.appspotmail.com@localhost

diffstat:

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

diffs (29 lines):

diff -r d080d6696944 -r 0f1981120261 sys/dev/usb/ulpt.c
--- a/sys/dev/usb/ulpt.c        Sat Jun 27 07:00:43 2020 +0000
+++ b/sys/dev/usb/ulpt.c        Sat Jun 27 07:29:11 2020 +0000
@@ -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 @@
        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;
 }



Home | Main Index | Thread Index | Old Index