From nobody Mon Jun 8 12:11:54 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23FE8318BB5 for ; Fri, 29 May 2026 09:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780045808; cv=none; b=ahvpxCrn9VDfnuwtjiGrote4uXa7aYudTm8eO7p8t6lflM2tY7Lp7GkLHR7GbWTOW4F/eoAT8qCetoUJaSdLn+x2gWr8DWr1CMoJdYP5nQXlKzV+5eQftZcZaASTMN5iio4uKcBmwm7RdpAR0LjGcVEBaf2bvjkb65vrmLKwS3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780045808; c=relaxed/simple; bh=+Arbk+Ag/YtsDlZ/g01Ccd7EXpX8ItsEZarsO0NQV18=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=Pm3KunbXe+nBYD3WvIYyrT2RdqPjP8HvXJp0b3gIvZPsfC/4Cm7dO7Y6FL0FaqYz+xko5H304NGEBcSTKMvtNst3PZdsnHLmqt3vTyTsaHkciI/QL5yZ8BZS58EEb+Q1Rw3fUUBGWrbdpXNc0jT+SXNR1fEatZAagGox7KIe7A0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IqG3Zjqk; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IqG3Zjqk" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso92715345e9.2 for ; Fri, 29 May 2026 02:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780045805; x=1780650605; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=/1/chd/0Eg7IccK0AHoHDnIKOULdYOVL4SXq0meVkTw=; b=IqG3Zjqkb2UYLoECVITfm8DKrUqUjT159z3jq3qJfIO90lCU6bSo8DMTCWatfnWH1Z h752V9UnGtS3A4MIq3H2yQM705SnJAJK940uxktV/qByYqRQSDNNcPAJxaw99n8kZLhl Wo+HeqUCyTVDR0buGvE8qRrZfNSaoebzYtrdd+4f3n2sgQuxdMq27G8svwEVx8m+zlCn uuE++t/rhqPjzVLKWq99lDOvcdAQd6h+gcjECC6tnv9hQ1wKs+pw/9FZca113yOVbDLg 780k8n4qNas1zGhejgn1610xrSbWzmY2XIGHAeLYdkYnnYkFB3t24UiKPLajml3w4R/z JJmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780045805; x=1780650605; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/1/chd/0Eg7IccK0AHoHDnIKOULdYOVL4SXq0meVkTw=; b=S5npGPhwYNc721z5hiok390cPnRnK9V4N5K6rn8uDWjHHzbzw+ikuA/TdfppNyIrnr vzqoYYrjJ9f+YkArTzMcRzOxffCMNDyl18iLabgpxX9o8pUFp1vhUQ6nkZ7P+xYSKEsF dEsGF+YrZ2UGDaAp4t+IerKpc4UKD56VkGNe2b4GFhXbXv0s1iLJvRe7I4fGiKqjP7RA eZxqjOU83tGiwEg8kH0IJMUYj4oBJH6N53R0eCfAtO+50BEp2wzVZk92c7U9IB5DBgcN 0PLL3T5tq9gE/LLbQbeqpTfuu3P9Bpq8LYtBmyi+scdXixLThZn6dcSgD/AnMtVIGInB M9Yw== X-Forwarded-Encrypted: i=1; AFNElJ+Q8a/NdNcbAi52cKX57lSHy7Oa5BpuKOPcYE7Mt4Yig4m2L3WYWma4YfzL9han9+2TgjjsD4aexxO8/xg=@vger.kernel.org X-Gm-Message-State: AOJu0YwpvmOoHG4Dhw5OvStKTs9yogcFuEKJ73voExiqfKx5u4PqMnTS DjqTIjOD9bQnT/09u6X7TvxrEFHxo36RyO4P3RYoUamIidSviMVO5ajD X-Gm-Gg: Acq92OEy8sJpUkUbgW6xuvIG3qHS/aMWTksu2R1gRXdokZrdn7hkf3US6+R9m8U10MT l8ithO4kjYJZsMyYY66OEfUGoX5RtrwpUQoDvM/Bq3UTumaBd3GDMQzDlDu7ljFJkfxmZEg7Vuw AKTg7Szw16xJH75kvaVfYNk51rzQ+6+kt1rahDmtfD9TvdixIqw332jFNJyevzShCRKCMKWDTtD aiJDXW2eu69ZAzM0JKnGnE0yFPrmhr0yELet1q8hf9x/UlgEJD3CFjlvQgeDmgEAVIThIxJhVIE kQoOMoQun7gVUSiRRt/p7GSFSx+6dqJevgF8VmKkFw/jYJTEDHMjw5FAjLCaE2yHxb0kOnzoOrx Qdgks8roiH5fI0ARXCqAq7zXE5P3ZoZ7335cD2UW2gGxSHDyAN4t/6vnN32DZGys6ZOI7SdiEO3 zOAnyxhpqFp0SdOnOnXU5cUnAci5bkaYP/3rPxiPhuPlD6IA== X-Received: by 2002:a05:600c:1550:b0:490:44eb:c1e9 with SMTP id 5b1f17b1804b1-4909c0bd916mr36783025e9.26.1780045805462; Fri, 29 May 2026 02:10:05 -0700 (PDT) Received: from foxbook (bfe246.neoplus.adsl.tpnet.pl. [83.28.42.246]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909c0c39b0sm15968405e9.2.2026.05.29.02.10.04 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 29 May 2026 02:10:05 -0700 (PDT) Date: Fri, 29 May 2026 11:10:02 +0200 From: Michal Pecio To: Mathias Nyman , Greg Kroah-Hartman Cc: Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: xhci: Remove skip_isoc_td() Message-ID: <20260529111002.7621e94b.michal.pecio@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This function is pointless because usb_submit_urb() initializes all isoc frame descriptors to -EXDEV and 0 length so that HCDs don't need to do anything with transfers which were never executed. Other HCDs rely on this (e.g. EHCI itd_complete()), so we can too. This gets rid of a potentially dangereous function which could corrupt memory if we weren't super careful to only call it on isoc URBs. Also, set status to 0 rather than any random status determined by the later TD which caused skipping. This status will be ignored anyway. Signed-off-by: Michal Pecio --- drivers/usb/host/xhci-ring.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index b8568a069897..a6c2f2373849 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2497,26 +2497,6 @@ static void process_isoc_td(struct xhci_hcd *xhci, s= truct xhci_virt_ep *ep, finish_td(xhci, ep, ep_ring, td, trb_comp_code); } =20 -static void skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - struct xhci_virt_ep *ep, int status) -{ - struct urb_priv *urb_priv; - struct usb_iso_packet_descriptor *frame; - int idx; - - urb_priv =3D td->urb->hcpriv; - idx =3D urb_priv->num_tds_done; - frame =3D &td->urb->iso_frame_desc[idx]; - - /* The transfer is partly done. */ - frame->status =3D -EXDEV; - - /* calc actual length */ - frame->actual_length =3D 0; - - xhci_dequeue_td(xhci, td, ep->ring, status); -} - /* * Process bulk and interrupt tds, update urb status and actual_length. */ @@ -2860,7 +2840,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, if (trb_comp_code =3D=3D COMP_STOPPED_LENGTH_INVALID) return 0; =20 - skip_isoc_td(xhci, td, ep, status); + /* + * TD was missed, skip it. Core already initialized frame->status + * to -EXDEV and frame->actual_length to 0, nothing more to do. + */ + xhci_dequeue_td(xhci, td, ep_ring, 0); =20 if (!list_empty(&ep_ring->td_list)) { if (ring_xrun_event) { --=20 2.48.1