Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2747800pxj; Mon, 31 May 2021 09:43:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSVhxKxVeVO9HMvZnxOcekUJiH+w4IsHWcRnWuazt8+hiwF/esn0rZIo5w/ElapbbZoyN6 X-Received: by 2002:a5e:8a08:: with SMTP id d8mr17771106iok.192.1622479434154; Mon, 31 May 2021 09:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479434; cv=none; d=google.com; s=arc-20160816; b=Gh1UqWQYoVEMurYENMDez3LmfwB5QzTLAKHRJdM63/nrsfJcowIo6vJgcO+yqfK6Sp bFLrXGKajiXcDg3MK5VHKeCwnpwQQHFBs8EMmvLb1r33cCxV109293s4hof89t8LbJf6 yUFnvX0RexGepng3qqJ3FXiWNDrEjatZkdCbhXgympn21nisHE+cxKeYie0NM+AX6FlZ hKxtQmSCNNfq6oSI9AXlQ4rR9yLNFiZgkq5oYqk+aQQytCh3uUyRNpgJQ8855s0zhuBk VGFilLDNyXDILok91ICd3Yas/SIoB2zNZT/dYCC31V8fB6Oib2sjA6YMhPc2B8nrbwUR anmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lS9TvyhGc0bJwG/OZWn+ScnJ+71aGc0qQN/w+WNNYCI=; b=PFDCiv8SD31vT/tONqdBb6voS9igc+Au90Lpj7QCc0uU1YcKemeXcILX+XMxePzk+w oPPeNXCxMdzBz1vTGBYiRmDdnMC/Kjw5BJGoJSlEKOTwHwsG9kCnmed95fkU4TR83p1l 3Sg7t6S61bJXPubSSz9s3vvLJM+rGUSrhc1eQnDPt1OLXCFsUVqyqUJyw4Hqxc+xiLKe F64i7K+Jyix9szNS28lpaHO+X9bSEZLIlMdlVviAVQuHqunXKn/xKvB3s5M1flw0h6oZ 1eR2yw1RtqZ7CA4lKBZ/+z31cCid1BrtwN21DWBON9DCK4CuZ909G5/Lnrp1TAbEsBrT P4Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wbjqZRdd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si15788428jas.16.2021.05.31.09.43.41; Mon, 31 May 2021 09:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wbjqZRdd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233734AbhEaQoH (ORCPT + 99 others); Mon, 31 May 2021 12:44:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:45320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234035AbhEaOxQ (ORCPT ); Mon, 31 May 2021 10:53:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BB4D61CA8; Mon, 31 May 2021 13:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469508; bh=KehBeMlUcm4nj9j+kHyJww7Flwp46LChGWKgxp7iCQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wbjqZRdd8e2V/rFimnzDYIER0bo2dxwG4w94Eak7Q4lWycdgM3sMXxeVgq0I/axPh JyBQgWWdFhdxLCv0v0J/e9wNgd00Txahf2tRoanYf2CKb4PI7l8yQzL8+FKIgh5421 feOU4Sr7tX4NCEiqRmliZBtU5rBFHlmGtoozQmYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pawel Laszczak , Peter Chen , Sasha Levin Subject: [PATCH 5.12 225/296] usb: cdnsp: Fix lack of removing request from pending list. Date: Mon, 31 May 2021 15:14:40 +0200 Message-Id: <20210531130711.387687081@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pawel Laszczak [ Upstream commit 3b414d1b0107fa51ad6063de9752d4b2a8063980 ] Patch fixes lack of removing request from ep->pending_list on failure of the stop endpoint command. Driver even after failing this command must remove request from ep->pending_list. Without this fix driver can stuck in cdnsp_gadget_ep_disable function in loop: while (!list_empty(&pep->pending_list)) { preq = next_request(&pep->pending_list); cdnsp_ep_dequeue(pep, preq); } Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") Signed-off-by: Pawel Laszczak Link: https://lore.kernel.org/r/20210420042813.34917-1-pawell@gli-login.cadence.com Signed-off-by: Peter Chen Signed-off-by: Sasha Levin --- drivers/usb/cdns3/cdnsp-gadget.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index 56707b6b0f57..c083985e387b 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -422,17 +422,17 @@ unmap: int cdnsp_ep_dequeue(struct cdnsp_ep *pep, struct cdnsp_request *preq) { struct cdnsp_device *pdev = pep->pdev; - int ret; + int ret_stop = 0; + int ret_rem; trace_cdnsp_request_dequeue(preq); - if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) { - ret = cdnsp_cmd_stop_ep(pdev, pep); - if (ret) - return ret; - } + if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) + ret_stop = cdnsp_cmd_stop_ep(pdev, pep); + + ret_rem = cdnsp_remove_request(pdev, preq, pep); - return cdnsp_remove_request(pdev, preq, pep); + return ret_rem ? ret_rem : ret_stop; } static void cdnsp_zero_in_ctx(struct cdnsp_device *pdev) -- 2.30.2