From nobody Sat May 30 08:51:30 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778081021; cv=none; d=zohomail.com; s=zohoarc; b=KFbr4ukNcFEhFU9UBhSbdWmgaxtq3joGgxhB45GdWLyOGOEveLAhc+/zr3D7bFwtI+U0VQ44XabyB0YDBi5EmXHZ9SGdmhZvOYj7t1S6mc63gLGoX8Lpl6dhujKnrg8CMrU0BMW7Uk3zjZQLaH/80HDUBTxMITtfzLMsHRCqvNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778081021; 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=RW1nafJmwXfg+AxhDXN24jZEiFjt3xSnoItD1s8MvLY=; b=UXCtnFK6hf8N43GdxsfFRbvHoDBoG0f4SofxC2Ot0GdKEQ/0GdyPAkafnC2bzGlZOJvIljrZMf3iR71ItGeb6LgxwP+hcbPqWyP5KHnH0FqeYVhJe8T+7o9usepJGwJGmUpPqe7CmH4CqHaAMbbZUoPJ0sY7gJtcceTi3rncRso= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778081021692433.7136384982492; Wed, 6 May 2026 08:23:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKe5j-0008Gc-1m; Wed, 06 May 2026 11:23:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKe5h-0008GK-EB for qemu-devel@nongnu.org; Wed, 06 May 2026 11:23:13 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wKe5f-0006yi-6U for qemu-devel@nongnu.org; Wed, 06 May 2026 11:23:13 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-36505450d0dso5086789a91.1 for ; Wed, 06 May 2026 08:23:10 -0700 (PDT) Received: from localhost.localdomain ([2407:6400:c000:f1c:edf4:b0bc:edd7:a9ab]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365b4c8a8e7sm3800052a91.13.2026.05.06.08.23.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 06 May 2026 08:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778080989; x=1778685789; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RW1nafJmwXfg+AxhDXN24jZEiFjt3xSnoItD1s8MvLY=; b=lQoKv+AIh1xUrbHwQeSlwEjsqnskD8OdBQTQ73cJIKywga3d1sj0Ue1est8WxhGzzN TtbdmBwp23u+LKcm4l/lW2/C/hHexuBPwp5k4iD4YAJZk/1hoZYOMugGQTRsWJmj3+iJ LUUzg1MZ4jywG1uLzbb4wjq6aOjsPGLhRmE0EGotsOSsP+rfs7V/zWAAVr+Oofjq+F+l 0neANPgus6HOSPYzL+dyNEO+l/MrTfgmeyFxx6aR4h1vD3HUlcV/YXw5+vtt4WB3lGaY 2JOCzoQ2KAOJbJkVPaoNDG0wSQ29jbdjVmQu1TxPsZmhtqQNDyzQefyIBTQMWbV+Hf0A mQqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778080989; x=1778685789; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RW1nafJmwXfg+AxhDXN24jZEiFjt3xSnoItD1s8MvLY=; b=lVcNRP0mOGi+lpFJqOly8xJ9AoWg8wa7wHJLNfc4N6jkt8hcQ4mrx55LA6AN3PS2Lf iaystRu0+vlDlaGtFG2RINFDSI/hf8gi1SL46DkfIbzDZqtpZn5DXWt+QPWmfiPrCL7b xJpNhLY1Uwp9gMkstGU4kZkSfhp8tMS8J5d5JABH90r9+78xhE689t2nH/hwwh2toN6U nsNOxemnh7HHVoxtEfNOlTOx9hKqF3qN4lv0dkb8un2I9Uq0s70xs8C8ckINCRZBALoz p6yjAp/TpT5/qNN4LSPVN9b4jhHiEOWT/GR9c6ounGEOh7+87vu3Pq8woXXPeRvgW5PW IBAg== X-Gm-Message-State: AOJu0YxUcBHrNAux+01Bl81EefcumupVFoVMVocBqtQpW8XunglLiWDq Wpp+9cXji4sqhV3OBt2qaD//KVnCJAOfO32iylS8+DwN8QPL7re220CkR8ofAOfzYE4= X-Gm-Gg: AeBDiesUpgv5scWrkDG4j5CWUpYYow6XpISiYIThjWzqAnmxWjyttNSVT0O9zrQTE9D YZYt55aEBGAVzrGQY3PPznpDUIyfZZZYLeB7PR1OznJB1Uouo7rN0LJdM3dlRq+o4u2QwEbHEv1 LhETyRWSGRKJlyoaiZAjVRGF7NaoJQVCrAkFsnfQa8RLOHqmljd0J6cq5uvlVoTo0Ua41UBmXNg aAB4+b/K/4O7Qt0+3a35sEn5ddZPLxPx2rcBDamOID4w3jxoZQ35jA1CbOoqp6Z66S/3ayEO5G0 ppdYcBfvzIPe5kIhS6M04/M3GVNY9s6P7q1FQfTK3498gwDu3o5yoWcxB3V0o6FmkUBCWYMkvRp AjqupzHuLeqLKjXWi9mGAC056BN2FhBCrE4e+ioKSCHM/lT2KoaSKwQ3TNQmcKmXIoHJ+gYH+Kz i3rs6aOxGje2QFl9vL3TrT1/V1skuiAlAfBNzq7HQkx+3wvsxABI62f1TNoSqvTjPP+aVFArp1a w== X-Received: by 2002:a17:90b:4fcd:b0:35f:b6d3:da7a with SMTP id 98e67ed59e1d1-365abe8a3f2mr4037221a91.15.1778080988857; Wed, 06 May 2026 08:23:08 -0700 (PDT) From: Munkhbaatar Enkhbaatar To: qemu-devel@nongnu.org Cc: Munkhbaatar Enkhbaatar , Peter Maydell Subject: [PATCH v2 1/2] hw/usb/hcd-ohci: Assert isochronous TDs are never deferred Date: Wed, 6 May 2026 23:22:46 +0800 Message-ID: <20260506152247.82336-2-munkhuu0825@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260506152247.82336-1-munkhuu0825@gmail.com> References: <20260506152247.82336-1-munkhuu0825@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=munkhuu0825@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 @gmail.com) X-ZM-MESSAGEID: 1778081022435158500 Content-Type: text/plain; charset="utf-8" Suggested-by: Peter Maydell Signed-off-by: Munkhbaatar Enkhbaatar Reviewed-by: Peter Maydell --- hw/usb/hcd-ohci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 6ed8046fc2..8f4de0066e 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -746,11 +746,10 @@ static int ohci_service_iso_td(OHCIState *ohci, struc= t ohci_ed *ed) usb_packet_setup(pkt, pid, ep, 0, addr, false, int_req); usb_packet_addbuf(pkt, buf, len); usb_handle_packet(dev, pkt); - if (pkt->status =3D=3D USB_RET_ASYNC) { - usb_device_flush_ep_queue(dev, ep); - g_free(pkt); - return 1; - } + + /* The USB core guarantees to never defer ISO TDs. */ + assert(pkt->status !=3D USB_RET_ASYNC); + if (pkt->status =3D=3D USB_RET_SUCCESS) { ret =3D pkt->actual_length; } else { --=20 2.50.1 (Apple Git-155) From nobody Sat May 30 08:51:30 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778081021; cv=none; d=zohomail.com; s=zohoarc; b=BftbjP/tj7zdnsZ3IdDoOfGrK74BSizPatDPvXtjdMohU16en4/UcU7ULkEqwpO8Bfvqp7yDcShrIWoUbWHzoGNBdrstdkrRMZbTZk4IR6wKPTrxyI5e+Ar5cJ2pYXpfVOASigrS19zZG8+UoL9bLQKoe85PqKsHlexO7K7IfWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778081021; 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=jhQssBYQMmeyrt0z4nSeNS8ZaDglLFgTQMywUFeRrNc=; b=m2tbzVxta149LIU9Qfm6hZeYmh4RdMXfcuqX+B0NkW3gktXbzTRJUWdW9TcyZZWPKGUiNJLeNWIKIBt23Njia4R/AKNnKe//NMld74HCeDDbP+t5XzZJoVzjlPpsHLY8av6d8zMXhSzgSRRv80N0Slg2/RCNYP3+NHs7Lz+BYIU= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778081021264659.1665445182686; Wed, 6 May 2026 08:23:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKe5m-0008Hg-PZ; Wed, 06 May 2026 11:23:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKe5l-0008HE-AX for qemu-devel@nongnu.org; Wed, 06 May 2026 11:23:17 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wKe5j-0006zV-RF for qemu-devel@nongnu.org; Wed, 06 May 2026 11:23:17 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-35fbca04006so3419012a91.1 for ; Wed, 06 May 2026 08:23:15 -0700 (PDT) Received: from localhost.localdomain ([2407:6400:c000:f1c:edf4:b0bc:edd7:a9ab]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365b4c8a8e7sm3800052a91.13.2026.05.06.08.23.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 06 May 2026 08:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778080994; x=1778685794; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jhQssBYQMmeyrt0z4nSeNS8ZaDglLFgTQMywUFeRrNc=; b=NdSFOI9ltmXd9YR1DQ9hdvpzJ97u5YkQM0tPMsLuR2reR6cjAdTJjzqYftaMh8IZCZ wTdFmo0dLQy6Q4zXNhXQtwHb4k32HO74g3nMQWe4oD4U6bsohWGjvxdonhbea97QifYi Vy2TcMOWmaWyJcW1fONdd4riW8Y/hpRthw7+ktNwykmWryuKLgTpAd046dOkonL/mMTh 5dbN01v6xraqjKx9yuzW5qbuhIOumh1/aznasuGb/Ua1VWqb/xbsCYAx8zb2wYNJs9Xk wCUvTAx2BMgkQHZR8K0DtMe8wCfeJXfnr8MLk0hdmyCI9yfEY2ztckMbh0bl3DXO+DpA EBnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778080994; x=1778685794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg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xaghafp0hPxqimA90y1FdGhV Q== X-Received: by 2002:a17:90b:3f45:b0:361:3224:2f5f with SMTP id 98e67ed59e1d1-365ac7754dcmr3966222a91.22.1778080993448; Wed, 06 May 2026 08:23:13 -0700 (PDT) From: Munkhbaatar Enkhbaatar To: qemu-devel@nongnu.org Cc: Munkhbaatar Enkhbaatar Subject: [PATCH v2 2/2] hw/usb/hcd-ohci: Clean up USBPacket before freeing ISO TD packet Date: Wed, 6 May 2026 23:22:47 +0800 Message-ID: <20260506152247.82336-3-munkhuu0825@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260506152247.82336-1-munkhuu0825@gmail.com> References: <20260506152247.82336-1-munkhuu0825@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=munkhuu0825@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 @gmail.com) X-ZM-MESSAGEID: 1778081022888154100 Content-Type: text/plain; charset="utf-8" ohci_service_iso_td() allocates a USBPacket and frees it after synchronous completion, but it does not call usb_packet_cleanup() first. Call usb_packet_cleanup() before g_free() so resources owned by USBPacket are released. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3463 Signed-off-by: Munkhbaatar Enkhbaatar Reviewed-by: Peter Maydell --- hw/usb/hcd-ohci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 8f4de0066e..40ebafb4dd 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -755,6 +755,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct = ohci_ed *ed) } else { ret =3D pkt->status; } + usb_packet_cleanup(pkt); g_free(pkt); =20 trace_usb_ohci_iso_td_so(start_offset, end_offset, start_addr, end_add= r, --=20 2.50.1 (Apple Git-155)