Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1334525imm; Thu, 23 Aug 2018 01:01:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZQ0VTtKPlfm6aaNgm9BnUpDvppvyD3XnRVLKUDPQCCXAChtV6UBH0FUQcpnxNLhyfL72fz X-Received: by 2002:a62:e008:: with SMTP id f8-v6mr9213298pfh.208.1535011273383; Thu, 23 Aug 2018 01:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535011273; cv=none; d=google.com; s=arc-20160816; b=HyKsONUN+AWunDVwS/8sRk0uehCEHp2jU4E+P87qfqU/+c+VxKm5hSCRHNzoTRlgyy apa2Rymh6cXQAcDHAmSBU04QAPOult0E//SftUpdpniwqoOx4q3Er3E/lun7wSludDz3 Lws2mwLD7paFM24ONVdrDgoD8i+YRoLLxU9gQvKuUu4E/ph+7PXqWZ5WhiLsu+NJe7xb ti8n3NmKX+9eOtys1RVCswETIBnfbcTZODCJuMPNMvve+QGu6WhwPoOhf4eQPp1eqzgv czGTd8VJrGZC4yRDqrbe9xQmTZZ88YoirOBBmFS/I4eZegi7rG4LL3rCQFWKj5H9TkiY uTAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TyrT2tHaMl2xYDmVvDqPF4Tsn+/0sMWn9B9F4FWrV3k=; b=F5kpuXFEGX0qtnjv2ilFZKCRRzHR5UvJ4JYqxZlRo9eTCmHNdeC07gztLBFVLm8ZCs Y47q0CESC0XrlqFeptmz/H8L0cTBnJZOswQi5u2bVBk3gR0Koc0gMREsSydniH0aNCKD 2CA+Sc+2unH9oRhErfpHFs+rAy2F52G5EWTJY8vqFC0xwCh3LYsDRs5Kee0PrIdlQGeQ pkEMmkitZJ/YvS68+C+CjW4RHxWdSKn9v4QoCsDf/G/HA9bV+cZUbWRUS2jq9Q0ldq8z fA7VCnkk9uMuAba4TsexdBoU85sBpqv1hpJ0wTgqTEObLq6enpAoGphIKVLUlBKWcuov WEgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si3660860pgh.360.2018.08.23.01.00.34; Thu, 23 Aug 2018 01:01:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727535AbeHWLZ6 (ORCPT + 99 others); Thu, 23 Aug 2018 07:25:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41610 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbeHWLZ6 (ORCPT ); Thu, 23 Aug 2018 07:25:58 -0400 Received: from localhost (5355525A.cm-6-6b.dynamic.ziggo.nl [83.85.82.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7E0399D2; Thu, 23 Aug 2018 07:57:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gevorg Sahakyan , Heiko Stuebner , William Wu , Felipe Balbi , Sasha Levin Subject: [PATCH 4.4 09/79] usb: dwc2: fix isoc split in transfer with no data Date: Thu, 23 Aug 2018 09:52:45 +0200 Message-Id: <20180823074919.282188634@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180823074918.641878835@linuxfoundation.org> References: <20180823074918.641878835@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: William Wu [ Upstream commit 70c3c8cb83856758025c2a211dd022bc0478922a ] If isoc split in transfer with no data (the length of DATA0 packet is zero), we can't simply return immediately. Because the DATA0 can be the first transaction or the second transaction for the isoc split in transaction. If the DATA0 packet with no data is in the first transaction, we can return immediately. But if the DATA0 packet with no data is in the second transaction of isoc split in transaction sequence, we need to increase the qtd->isoc_frame_index and giveback urb to device driver if needed, otherwise, the MDATA packet will be lost. A typical test case is that connect the dwc2 controller with an usb hs Hub (GL852G-12), and plug an usb fs audio device (Plantronics headset) into the downstream port of Hub. Then use the usb mic to record, we can find noise when playback. In the case, the isoc split in transaction sequence like this: - SSPLIT IN transaction - CSPLIT IN transaction - MDATA packet (176 bytes) - CSPLIT IN transaction - DATA0 packet (0 byte) This patch use both the length of DATA0 and qtd->isoc_split_offset to check if the DATA0 is in the second transaction. Tested-by: Gevorg Sahakyan Tested-by: Heiko Stuebner Acked-by: Minas Harutyunyan hminas@synopsys.com> Signed-off-by: William Wu Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc2/hcd_intr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -931,9 +931,8 @@ static int dwc2_xfercomp_isoc_split_in(s frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; len = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd, DWC2_HC_XFER_COMPLETE, NULL); - if (!len) { + if (!len && !qtd->isoc_split_offset) { qtd->complete_split = 0; - qtd->isoc_split_offset = 0; return 0; }