summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authordufault <dufault@FreeBSD.org>1995-03-03 21:38:43 +0000
committerdufault <dufault@FreeBSD.org>1995-03-03 21:38:43 +0000
commit78929da63cab7ac0a2bcc42e1c8e402e501f9434 (patch)
tree26317940b10dfc9696fcc2c3619998bb43de6880 /sys/scsi
parent6ab7eefa564b1c625ab6f847fb27d5c8e083d416 (diff)
downloadFreeBSD-src-78929da63cab7ac0a2bcc42e1c8e402e501f9434.zip
FreeBSD-src-78929da63cab7ac0a2bcc42e1c8e402e501f9434.tar.gz
Make sure there is a device before opening. Fixes NULL access
when opening unattached devices.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_driver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/scsi/scsi_driver.c b/sys/scsi/scsi_driver.c
index 8155c70..dab2d5b 100644
--- a/sys/scsi/scsi_driver.c
+++ b/sys/scsi/scsi_driver.c
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_ioctl.c,v 1.10 1995/01/19 12:41:36 dufault Exp $
+ * $Id: scsi_driver.c,v 1.1 1995/03/01 22:24:41 dufault Exp $
*
*/
#include <sys/types.h>
@@ -89,6 +89,9 @@ scsi_open(dev_t dev, int flags, struct scsi_device *device)
u_int32 unit;
struct scsi_link *sc_link;
+ if (device == 0)
+ return ENXIO;
+
unit = GETUNIT(device, dev);
sc_link = SCSI_LINK(device, unit);
OpenPOWER on IntegriCloud