* [PULL 0/1] Block layer patches
@ 2021-08-03 14:41 Kevin Wolf
2021-08-04 10:39 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2021-08-03 14:41 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel
The following changes since commit 7f1cab9c628a798ae2607940993771e6300e9e00:
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-08-02 17:21:50 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 87ab88025247b893aad5071fd38301b67be76d1a:
block: Fix in_flight leak in request padding error path (2021-08-03 15:43:30 +0200)
----------------------------------------------------------------
Block layer patches
- Fix hang after request padding error (Windows + 512-on-4k emulation)
----------------------------------------------------------------
Kevin Wolf (1):
block: Fix in_flight leak in request padding error path
block/io.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PULL 0/1] Block layer patches
2021-08-03 14:41 Kevin Wolf
@ 2021-08-04 10:39 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-08-04 10:39 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block
On Tue, 3 Aug 2021 at 15:41, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit 7f1cab9c628a798ae2607940993771e6300e9e00:
>
> Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-08-02 17:21:50 +0100)
>
> are available in the Git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 87ab88025247b893aad5071fd38301b67be76d1a:
>
> block: Fix in_flight leak in request padding error path (2021-08-03 15:43:30 +0200)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - Fix hang after request padding error (Windows + 512-on-4k emulation)
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 0/1] Block layer patches
@ 2022-08-23 14:04 Kevin Wolf
2022-08-23 14:04 ` [PULL 1/1] scsi-generic: Fix emulated block limits VPD page Kevin Wolf
2022-08-23 19:16 ` [PULL 0/1] Block layer patches Richard Henderson
0 siblings, 2 replies; 5+ messages in thread
From: Kevin Wolf @ 2022-08-23 14:04 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel
The following changes since commit ba58ccbef60338d0b7334c714589a6423a3e7f91:
Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging (2022-08-19 09:35:29 -0700)
are available in the Git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 51e15194b0a091e5c40aab2eb234a1d36c5c58ee:
scsi-generic: Fix emulated block limits VPD page (2022-08-23 16:01:13 +0200)
----------------------------------------------------------------
Block layer patches
- scsi-generic: Fix I/O errors due to wrong block limits
----------------------------------------------------------------
Kevin Wolf (1):
scsi-generic: Fix emulated block limits VPD page
hw/scsi/scsi-generic.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 1/1] scsi-generic: Fix emulated block limits VPD page
2022-08-23 14:04 [PULL 0/1] Block layer patches Kevin Wolf
@ 2022-08-23 14:04 ` Kevin Wolf
2022-08-23 19:16 ` [PULL 0/1] Block layer patches Richard Henderson
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2022-08-23 14:04 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel
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 | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index ada24d7486..3d35d307e1 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -147,6 +147,18 @@ static int execute_command(BlockBackend *blk,
return 0;
}
+static uint64_t calculate_max_transfer(SCSIDevice *s)
+{
+ uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
+ uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
+
+ assert(max_transfer);
+ max_transfer = MIN_NON_ZERO(max_transfer,
+ max_iov * qemu_real_host_page_size());
+
+ return max_transfer / s->blocksize;
+}
+
static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
{
uint8_t page, page_idx;
@@ -179,12 +191,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
(r->req.cmd.buf[1] & 0x01)) {
page = r->req.cmd.buf[2];
if (page == 0xb0) {
- uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
- uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
-
- assert(max_transfer);
- max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size())
- / s->blocksize;
+ uint64_t max_transfer = calculate_max_transfer(s);
stl_be_p(&r->buf[8], max_transfer);
/* Also take care of the opt xfer len. */
stl_be_p(&r->buf[12],
@@ -230,7 +237,7 @@ static int scsi_generic_emulate_block_limits(SCSIGenericReq *r, SCSIDevice *s)
uint8_t buf[64];
SCSIBlockLimits bl = {
- .max_io_sectors = blk_get_max_transfer(s->conf.blk) / s->blocksize
+ .max_io_sectors = calculate_max_transfer(s),
};
memset(r->buf, 0, r->buflen);
--
2.37.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL 0/1] Block layer patches
2022-08-23 14:04 [PULL 0/1] Block layer patches Kevin Wolf
2022-08-23 14:04 ` [PULL 1/1] scsi-generic: Fix emulated block limits VPD page Kevin Wolf
@ 2022-08-23 19:16 ` Richard Henderson
1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2022-08-23 19:16 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: qemu-devel
On 8/23/22 07:04, Kevin Wolf wrote:
> The following changes since commit ba58ccbef60338d0b7334c714589a6423a3e7f91:
>
> Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging (2022-08-19 09:35:29 -0700)
>
> are available in the Git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 51e15194b0a091e5c40aab2eb234a1d36c5c58ee:
>
> scsi-generic: Fix emulated block limits VPD page (2022-08-23 16:01:13 +0200)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - scsi-generic: Fix I/O errors due to wrong block limits
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-23 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 14:04 [PULL 0/1] Block layer patches Kevin Wolf
2022-08-23 14:04 ` [PULL 1/1] scsi-generic: Fix emulated block limits VPD page Kevin Wolf
2022-08-23 19:16 ` [PULL 0/1] Block layer patches Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2021-08-03 14:41 Kevin Wolf
2021-08-04 10:39 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).