Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1161629ybf; Thu, 27 Feb 2020 06:08:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxXn9HPR9SbNOPp+hD0taGemZNkXeEKSO+88TuUp0HsXPVlb9SR3yrYtL/n6lu8WxAXt2xN X-Received: by 2002:a05:6808:64d:: with SMTP id z13mr3456219oih.104.1582812529148; Thu, 27 Feb 2020 06:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582812529; cv=none; d=google.com; s=arc-20160816; b=IgFlpEmSUuiICwDthdQ2uAr7/2bakAPIvx9uvpSKLf/WzRZJvTqoJjl6VW9IQZ9JBj EaNkzjZn+6d6LsNrdrgjwOk62V69zSVhEsiG1FCT4rjGXlUvPp4FY2flMrXy63xxHtoU WhXDcd1bEHQe8ZRG6h8Wuda+p0cO0th6o0xbn/V+k+Mg2dyK5IlcumBk0mMcQq5BTNYO PFGPtsU2XRn/VX313n9W6zS50djxkPcg7DOA37HtrseNhxpk7fdgCylycf0CFuX1+wVB JN4FiZw7FyU8WKrmskSrGxCrBiGKMkR8/D3yHQNbWX17J2awIYx7LpF7F+QHEr4QG0kn NWgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0pPzKHh/nj4EXzbHjeIsgz6v9tNnVgfTsuyFtwFgoT8=; b=i0vnfbcjKhVrRpB/aYGh6XTXMbNeHEz0T92mf0o7A1P1z1ID3DI/aMeVpblaZHY63T PxOazTtLaV5IAE2BJmutVgbtkO1/+TwK9xt+dE+TCrzXzKh0iV6BPbPuBkvzZF1h9MCU l2hHOCEAotdp0112yc0HR4ApUFc9htE7FkG7SzVXd9z/v8YYfMjZ2fiSZD0wAdeYI9mW /H1X/OahIg08KSYM8VVvUeM+xezxKx5abAL1HMKcm5+zoaavblODRw5el052oBR7UnIb u8Un8zHVTW9hBUx7WaGaeey+V8HtbYshQiOMceaYjWHwXiPEwl89/XQ4tg8emOc3jeUx li+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DMscM9Yh; 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 y22si1530696oti.269.2020.02.27.06.08.24; Thu, 27 Feb 2020 06:08:49 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=DMscM9Yh; 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 S2387853AbgB0OF5 (ORCPT + 99 others); Thu, 27 Feb 2020 09:05:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:42858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387847AbgB0OFz (ORCPT ); Thu, 27 Feb 2020 09:05:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C193520578; Thu, 27 Feb 2020 14:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812355; bh=uhH67BUgioUdLRY7U4lxoaW4esQN3FChvKJGkYYFphI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMscM9YhRIqXB6nNaiIyBoaxyvGqy4ecT/tzIiohpTKlobrs+tmWQcPCh8yCCBaks JR5AWvAWSEGg0lrvRMNPrA9DTjqXDVomxK9PnHQx6+g233Ap/ZuXLcGTbQ7PxnGHLI t+sDjWcpAcKQongerGYIXtGpNSV0XgNE3o0CPpf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , Felipe Balbi Subject: [PATCH 4.19 83/97] usb: dwc2: Fix in ISOC request length checking Date: Thu, 27 Feb 2020 14:37:31 +0100 Message-Id: <20200227132228.139177930@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132214.553656188@linuxfoundation.org> References: <20200227132214.553656188@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minas Harutyunyan commit 860ef6cd3f90b84a1832f8a6485c90c34d3b588b upstream. Moved ISOC request length checking from dwc2_hsotg_start_req() function to dwc2_hsotg_ep_queue(). Fixes: 4fca54aa58293 ("usb: gadget: s3c-hsotg: add multi count support") Signed-off-by: Minas Harutyunyan Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc2/gadget.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1004,11 +1004,6 @@ static void dwc2_hsotg_start_req(struct else packets = 1; /* send one packet if length is zero. */ - if (hs_ep->isochronous && length > (hs_ep->mc * hs_ep->ep.maxpacket)) { - dev_err(hsotg->dev, "req length > maxpacket*mc\n"); - return; - } - if (dir_in && index != 0) if (hs_ep->isochronous) epsize = DXEPTSIZ_MC(packets); @@ -1312,6 +1307,13 @@ static int dwc2_hsotg_ep_queue(struct us req->actual = 0; req->status = -EINPROGRESS; + /* Don't queue ISOC request if length greater than mps*mc */ + if (hs_ep->isochronous && + req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) { + dev_err(hs->dev, "req length > maxpacket*mc\n"); + return -EINVAL; + } + /* In DDMA mode for ISOC's don't queue request if length greater * than descriptor limits. */