Fix NULL deref, to prevent kernel crashes when detaching an udsbr0 device.
Found with vHCI.
This commit is contained in:
parent
146bab28ab
commit
f1f5729782
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: udsbr.c,v 1.27 2019/05/05 03:17:54 mrg Exp $ */
|
||||
/* $NetBSD: udsbr.c,v 1.28 2019/09/14 12:50:16 maxv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: udsbr.c,v 1.27 2019/05/05 03:17:54 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: udsbr.c,v 1.28 2019/09/14 12:50:16 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_usb.h"
|
||||
@ -174,8 +174,9 @@ udsbr_detach(device_t self, int flags)
|
||||
|
||||
if (sc->sc_child != NULL)
|
||||
rv = config_detach(sc->sc_child, flags);
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user