Skip to content

Commit

Permalink
OvmfPkg: Pass correct virtio-scsi request size
Browse files Browse the repository at this point in the history
The patch at "1fc55a3933b0 OvmfPkg: Use heap memory
for virtio-scsi request" modified the virtio-scsi
request header memory to be allocated from the heap.
In doing so the request structure header which was
a local variable on the stack was converted to be a
pointer. This required adjusting the size computation
for the request header to reflect that the structure
was changed to a pointer.
Unfortunately, this was missed out in the call to
VirtioAppendDesc() for enqueuing the request due to
which only 8 bytes were being shared with the host
instead of the size of the VIRTIO_SCSI_REQ structure
which is 51 bytes.

This resulted in the following error message to
be printed by qemu: "qemu-system-<arch>: wrong size
for virtio-scsi headers" and the virtio-scsi
functionality degraded.

Therefore, pass the correct size of the virtio-scsi
request header when enqueuing the request.

Reported-by: Aithal Srikanth <[email protected]>
Tested-by: Aithal Srikanth <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
  • Loading branch information
samimujawar authored and mergify[bot] committed Aug 2, 2024
1 parent 24a375f commit f203a6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion OvmfPkg/VirtioScsiDxe/VirtioScsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ VirtioScsiPassThru (
VirtioAppendDesc (
&Dev->Ring,
RequestDeviceAddress,
sizeof Request,
sizeof (*Request),
VRING_DESC_F_NEXT,
&Indices
);
Expand Down

0 comments on commit f203a6d

Please sign in to comment.