1. Reject obviously broken CDB command lengths

2. Use "uprintf" (instead of printf) to log the "tape not ready" message
This commit is contained in:
dufault 1995-01-24 12:04:56 +00:00
parent a9e08ab1e3
commit fd80285ef9
2 changed files with 18 additions and 3 deletions

View File

@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.16 1995/01/08 13:38:31 dufault Exp $
* $Id: scsi_base.c,v 1.17 1995/01/19 12:41:35 dufault Exp $
*/
#define SPLSD splbio
@ -406,6 +406,21 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
errval retval;
u_int32 s;
/*
* Illegal command lengths will wedge host adapter software.
* Reject zero length commands and assert all defined commands
* are the correct length.
*/
if (cmdlen == 0)
return EFAULT;
else
{
static u_int8 sizes[] = {6, 10, 10, 0, 0, 12, 0, 0 };
u_int8 size = sizes[((scsi_cmd->opcode) >> 5)];
if (size && (size != cmdlen))
return EIO;
}
if (bp && !(flags & SCSI_USER)) flags |= SCSI_NOSLEEP;
SC_DEBUG(sc_link, SDEV_DB2, ("scsi_cmd\n"));

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* $Id: st.c,v 1.23 1994/12/16 06:03:26 phk Exp $
* $Id: st.c,v 1.24 1995/01/08 13:38:36 dufault Exp $
*/
/*
@ -602,7 +602,7 @@ stopen(dev, flags)
* This time take notice of the return result
*/
if (errno = (scsi_test_unit_ready(sc_link, 0))) {
printf("st%d: not ready\n", unit);
uprintf("st%d: not ready\n", unit);
st_unmount(unit, NOEJECT);
return (errno);
}