mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-29 12:44:53 +01:00
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:
parent
a9e08ab1e3
commit
fd80285ef9
@ -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"));
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user