mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
scsi: Add buf_len parameter to scsi_req_new()
When a SCSI command is received from the guest, the CDB length implied by the first byte might exceed the number of bytes the guest sent. In this case scsi_req_new() will read uninitialized data, causing unpredictable behavior. Adds the buf_len parameter to scsi_req_new() and plumbs it through the call stack. Signed-off-by: John Millikin <john@john-millikin.com> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1127 Message-Id: <20220817053458.698416-1-john@john-millikin.com> [Fill in correct length for adapters other than ESP. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c6e51f1bb2
commit
fe9d8927e2
13 changed files with 45 additions and 33 deletions
|
@ -324,7 +324,8 @@ static int mptsas_process_scsi_io_request(MPTSASState *s,
|
|||
}
|
||||
|
||||
req->sreq = scsi_req_new(sdev, scsi_io->MsgContext,
|
||||
scsi_io->LUN[1], scsi_io->CDB, req);
|
||||
scsi_io->LUN[1], scsi_io->CDB,
|
||||
scsi_io->CDBLength, req);
|
||||
|
||||
if (req->sreq->cmd.xfer > scsi_io->DataLength) {
|
||||
goto overrun;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue