DaynaPort: Ignore commands with a bogus control value (#433)

All traffic from the DaynaPort will have a control value of 0xc0 or
0x80, so any commands that don't should be ignored.

This helps the Mac Plus which will try to READ(6) from the DaynaPort
device if it's attached at boot and then try to interpret the
ethernet packet as hard drive data and crash.

See issue akuker#419
This commit is contained in:
joshua stein 2021-11-08 15:42:54 -06:00 committed by GitHub
parent f7ec0de834
commit f2b5d86fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -506,6 +506,14 @@ void SCSIDaynaPort::Read6(SASIDEV *controller)
record |= ctrl->cmd[3];
ctrl->blocks=1;
// If any commands have a bogus control value, they were probably not
// generated by the DaynaPort driver so ignore them
if (ctrl->cmd[5] != 0xc0 && ctrl->cmd[5] != 0x80) {
LOGTRACE("%s Control value %d, (%04X), returning invalid CDB", __PRETTY_FUNCTION__, ctrl->cmd[5], ctrl->cmd[5]);
controller->Error(ERROR_CODES::sense_key::ILLEGAL_REQUEST, ERROR_CODES::asc::INVALID_FIELD_IN_CDB);
return;
}
LOGTRACE("%s READ(6) command record=%d blocks=%d", __PRETTY_FUNCTION__, (unsigned int)record, (int)ctrl->blocks);
ctrl->length = Read(ctrl->cmd, ctrl->buffer, record);