From nobody Wed Apr 1 23:53:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774969484; cv=none; d=zohomail.com; s=zohoarc; b=NtQH+1vkpEhlFIg3hzfqUw3Y0jQbdTkfE6pNU4JzzguorBR4UVcBBHWkA3bg7UmyA6EEXaACuCmNBdhLgHCD4/0QoF1LVWMzEj7+fJWkALdri4js1ziNjh5hiqzlB8o81R1GzmfgIqN4P1wqpXpaI/UdPXk5YH9MoAgK20ghHWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969484; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0w+FkwPEOE9/aTogVmMcduV786B/IV6iPoHRVRGznug=; b=Pp/IkGY/2QUribYawfaN9NE9Dt/QRkdrq5k6LmnbG0tmPlGFMb0RzE/LTN4mbiNLwpOSWlL7SqjixreucACF+kbQogCf5HkrhnAXjLV6/fDIeTr214Ig0lQUxQp+5ffthAhmNed075o3D7aq+140L8J2yOXJx1RVTLEgNJnfUoA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969484945835.8228594472366; Tue, 31 Mar 2026 08:04:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adU-0003BC-Er; Tue, 31 Mar 2026 11:04:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adT-0003AS-K0 for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adR-0002XK-Cr for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:07 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-WqoFMJCsMyG0fIcaYS17fw-1; Tue, 31 Mar 2026 11:04:00 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C3FC18005AF; Tue, 31 Mar 2026 15:03:59 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 192D71954102; Tue, 31 Mar 2026 15:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0w+FkwPEOE9/aTogVmMcduV786B/IV6iPoHRVRGznug=; b=PQ/QzSowe/+OL/+g7fdcPID2zz1fGxlpGqPBaGmdTgSIKirZrL2hSVScPK8wAsV3n7rh3V Xs4cdR0Fj5sPNVBuV3cOfP7gPtOpo1AlK2MvWIkDSbPg6BMiXjqlAGsE5Tg+4FJCksOmos nSgjSRGtKAU9pjJ9PPsA1EUYc0QnA84= X-MC-Unique: WqoFMJCsMyG0fIcaYS17fw-1 X-Mimecast-MFC-AGG-ID: WqoFMJCsMyG0fIcaYS17fw_1774969439 From: Kevin Wolf 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 Message-ID: <20260331150352.256332-2-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774969488610154100 Content-Type: text/plain; charset="utf-8" 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 =3D=3D 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 Signed-off-by: Kevin Wolf Message-ID: <20260326165124.138593-1-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- 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 =3D 0; /* not needed by IDE spec, but needed by Windows */ sector_num =3D ide_get_sector(s); n =3D s->nsector; + ide_set_retry(s); =20 if (n =3D=3D 0) { ide_transfer_stop(s); --=20 2.53.0