]> git.proxmox.com Git - mirror_qemu.git/commit
scsi-generic: Fix emulated block limits VPD page
authorKevin Wolf <kwolf@redhat.com>
Mon, 22 Aug 2022 12:53:20 +0000 (14:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 23 Aug 2022 14:01:13 +0000 (16:01 +0200)
commit51e15194b0a091e5c40aab2eb234a1d36c5c58ee
tree5d568e638155d8447f483e30f0e93de16a90e9b6
parentba58ccbef60338d0b7334c714589a6423a3e7f91
scsi-generic: Fix emulated block limits VPD page

Commits 01ef8185b80 amd 24b36e9813e updated the way that the maximum
transfer length is calculated for patching block limits VPD page in an
INQUIRY response.

The same updates also need to be made for the case where the host device
does not support the block limits VPD page at all and we emulate the
whole page.

Without this fix, on host block devices a maximum transfer length of
(INT_MAX - sector_size) bytes is advertised to the guest, resulting in
I/O errors when a request that exceeds the host limits is made by the
guest. (Prior to commit 24b36e9813e, this code path would use the
max_transfer value from the host instead of INT_MAX, but still miss the
fix from 01ef8185b80 where max_transfer is also capped to max_iov
host pages, so it would be less wrong, but still wrong.)

Cc: qemu-stable@nongnu.org
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2096251
Fixes: 01ef8185b809af9d287e1a03a3f9d8ea8231118a
Fixes: 24b36e9813ec15da7db62e3b3621730710c5f020
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20220822125320.48257-1-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/scsi/scsi-generic.c