From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: [PULL 1/6] ide: Fix potential assertion failure on VM stop for PIO read error
Date: Tue, 31 Mar 2026 17:03:47 +0200 [thread overview]
Message-ID: <20260331150352.256332-2-kwolf@redhat.com> (raw)
In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com>
ide_sector_read() as well as its callers neglect to call ide_set_retry()
before starting I/O. If the I/O fails, this means that the retry
information is stale. In particular, ide_handle_rw_error() has an
assertion that s->bus->retry_unit == s->unit, which can fail if either
there was no previous request or it came from another device on the bus.
If the assertion weren't there, a wrong request would be retried after
resuming the VM.
Fix this by adding a ide_set_retry() call to ide_sector_read().
This affects only reads because ide_transfer_start() does call
ide_set_retry(). For writes, the data transfer comes first and the I/O
is only started when the data has been read into s->io_buffer, so by
that time, ide_set_retry() has been called. For reads, however, the I/O
comes first and only then the data is transferred to the guest, so the
call in ide_transfer_start() is too late.
Buglink: https://redhat.atlassian.net/browse/RHEL-153537
Reported-by: Tingting Mao <timao@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20260326165124.138593-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index d6719dbf31d..7a15d6cac9b 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -799,6 +799,7 @@ static void ide_sector_read(IDEState *s)
s->error = 0; /* not needed by IDE spec, but needed by Windows */
sector_num = ide_get_sector(s);
n = s->nsector;
+ ide_set_retry(s);
if (n == 0) {
ide_transfer_stop(s);
--
2.53.0
next prev parent reply other threads:[~2026-03-31 15:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 15:03 [PULL 0/6] Block layer patches Kevin Wolf
2026-03-31 15:03 ` Kevin Wolf [this message]
2026-03-31 15:03 ` [PULL 2/6] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable Kevin Wolf
2026-03-31 15:03 ` [PULL 3/6] block: Fix references in bdrv_bsc_*() function comments Kevin Wolf
2026-03-31 15:03 ` [PULL 4/6] monitor: Fix deadlock in monitor_cleanup Kevin Wolf
2026-04-04 6:02 ` Michael Tokarev
2026-04-04 6:08 ` Michael Tokarev
2026-04-07 12:04 ` Kevin Wolf
2026-04-07 13:30 ` Michael Tokarev
2026-04-07 16:46 ` Kevin Wolf
2026-04-07 17:12 ` Michael Tokarev
2026-04-08 9:05 ` Kevin Wolf
2026-04-07 16:57 ` Michael Tokarev
2026-03-31 15:03 ` [PULL 5/6] vhost-user-blk-server: fix opt_io_size=1 causing severe Windows I/O degradation Kevin Wolf
2026-03-31 15:03 ` [PULL 6/6] block: Fix crash after setting latency historygram with single bin Kevin Wolf
2026-03-31 18:04 ` [PULL 0/6] Block layer patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331150352.256332-2-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.