From 42de29841bed07d98b88577967a4985c8793198b Mon Sep 17 00:00:00 2001 From: drochner Date: Thu, 3 Apr 2008 14:07:01 +0000 Subject: [PATCH] restore error handling in usbopen() (accidentally removed in a recent commit), should fix a crash reported by Arto Huusko --- sys/dev/usb/usb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 57cfab1be544..6d0b8ed7b016 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.110 2008/03/30 15:37:49 ad Exp $ */ +/* $NetBSD: usb.c,v 1.111 2008/04/03 14:07:01 drochner Exp $ */ /* * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.110 2008/03/30 15:37:49 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.111 2008/04/03 14:07:01 drochner Exp $"); #include "opt_compat_netbsd.h" @@ -455,6 +455,8 @@ usbopen(dev_t dev, int flag, int mode, struct lwp *l) } sc = device_lookup_private(&usb_cd, unit); + if (!sc) + return (ENXIO); if (sc->sc_dying) return (EIO);