From nobody Mon Feb 9 12:25:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831402; cv=none; d=zohomail.com; s=zohoarc; b=CYxA+tnhmpb808wOAmU1qg7ejXNjXnYA7+gwrblg4NSm0BZOBzHc/+tkTr0M/JmJEcXfCj6jcLnX2kWGfELSjvAqDyAbHGAmmRSh4bSIoxD67CX/S6PAIT9GVjYEcRI6bHlol+dbAUq+oj/AGq00G7CVtG00eTRdZQRiyI7Qxp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831402; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nqJow56vo8H02Enc88863yrq478CXxEGIatZH3j+5VQ=; b=hhPxt1SnX+RBwLhqP3LORlgkythO1Agg7S0qljSQphLifmKUzUljOr2wCuNfohDeklbTOHtcBF+DXThnG6k0tZSZzCRnFJHRzRkIg+9daRctQYghEq0LYPkiiVUutI+B0VNgt9NyEsIWFb85tjhZsUM1ZRq6Pn1TUBKlWV1pbAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831402797868.5966028475247; Mon, 15 Mar 2021 11:03:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-AK0XM5i-NEqkTI_4JAxhZg-1; Mon, 15 Mar 2021 14:03:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBD2F81871C; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDAE819D7C; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7810857DCD; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2qHF007533 for ; Mon, 15 Mar 2021 14:02:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id ABB715DEAD; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B8145D9C0; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AF5E71800843; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831401; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nqJow56vo8H02Enc88863yrq478CXxEGIatZH3j+5VQ=; b=a3jdHyXAaJFTuSdyGM/cHHCvQjSMvfQiUFOkeEWbQH24I9wBba3FnNS6NUUBYnYsQiD+ON WWQVDxP502KCZdu1b+UGAbIw5JC1bcjdnWNmE3SoUNWXEQSikY/yUuYKSWtk1P/2ri7Vzd UAqnWQjv4wS5tlBsgw+EqGGUk2ZgX1c= X-MC-Unique: AK0XM5i-NEqkTI_4JAxhZg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 13/13] usb/storage: clear csw on reset Date: Mon, 15 Mar 2021 19:02:40 +0100 Message-Id: <20210315180240.1597240-14-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Stale data in csw (specifically residue) can confuse the state machine and allows the guest trigger an assert(). So clear csw on reset to avoid this happening in case the guest resets the device in the middle of a request. Buglink: https://bugs.launchpad.net/qemu/+bug/1523811 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210312094954.796799-1-kraxel@redhat.com> --- hw/usb/dev-storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 7b587ad051ff..dca62d544fe9 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -313,6 +313,7 @@ void usb_msd_handle_reset(USBDevice *dev) usb_msd_packet_complete(s); } =20 + memset(&s->csw, 0, sizeof(s->csw)); s->mode =3D USB_MSDM_CBW; } =20 --=20 2.29.2