Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2710745pxj; Mon, 31 May 2021 08:49:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysUzYTmXH/bMmOjU92vcGCWuiccL7knNFYF3300trNxu6sFVqRkmdS7+E3OYhRBS3aaLmW X-Received: by 2002:aa7:d7d5:: with SMTP id e21mr26554179eds.78.1622476187527; Mon, 31 May 2021 08:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476187; cv=none; d=google.com; s=arc-20160816; b=wmMjKTbDZ89ojtuGc28BdSblhjrnpoOqOb1GH3KEVQX9lrImmz7lzRt5uBHMWQ6SAx SW7oFwT90eLU2pn/Nir2azV5TnVguXLbrqcE28QgktOToG4CxnT7zyenp47c8cLRZaFT a1QB/DwcmhWDYjh3OXEpwadKc0UK4KfUVCsy6+lM/gi6J0Gh0QAVbgJPRTR/Iicd7eyu g1rT6GWKllkypPhxqUe6CovQm+s6+vVNv6ScD225YmaCegUeukUAZrhJAUx2bpn8Wj7W vdWwZbBil8RjHB6j9ygtPC/g/dXCozMHyR1uYnW4rhQzpLhDSRzFfU/gjTyvhQQsq1tE Jx9g== 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=AdWQ8c6ScocrrGdgIhlZ9Cm7NFX4/FYOLHqux4mRpLI=; b=GUrI0ZMy9DmSiBZwjD3C+EEWr1sz9wyT7POf0qwVvVjEDhE54l2LPqZFsFFvn5oJu8 hvc8a0YBdWABATcot2ia87XvNnXqKMG1IKsDvzC2mvgbYaCxOvToNUElxi/vajnJvgEm 9zzIKC1w8bzOuQARk9Glu2h5HqBYEmY0abFCkTNlXIG0wsY1kXqap8YAuvMKIwPtD1pJ 5qDXo2qmGjc7VDLx+DSola9lad4nAacBCQBnECYw8dz4HVjU3zEVymNfJJMXVygoKYqI Hr5Zsu1FTKFoCwfuXH09lbZVMHXgB0840gDMqtpttReUk7jH1p0X2OIXW3E8UB7XbfQT zRFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FGi4YQgb; 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 k4si3494145eds.218.2021.05.31.08.49.25; Mon, 31 May 2021 08:49:47 -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=FGi4YQgb; 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 S234451AbhEaPtz (ORCPT + 99 others); Mon, 31 May 2021 11:49:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233869AbhEaO1g (ORCPT ); Mon, 31 May 2021 10:27:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E6126161F; Mon, 31 May 2021 13:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468868; bh=+gR+FMGGGlAhOlGUA3e8RprGHDS4xiMb/fyoXenxcDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGi4YQgbPJrSnl3MzTAHzqy9w9dz1kHh/swlNKS2qCYpjJhBUQWxrTCHhSj7Cr7N5 o9I6LxQUXiZhi0iQzd1yOVXJplfZyrsCMQrPKbwyLgnl4pXlFGrol5vnm62w6lNA3s PWO1mJg23nDArwdxRl1z/7/vbUWboTFAz23fL1Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.4 158/177] staging: emxx_udc: fix loop in _nbu2ss_nuke() Date: Mon, 31 May 2021 15:15:15 +0200 Message-Id: <20210531130653.377779485@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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: Dan Carpenter [ Upstream commit e0112a7c9e847ada15a631b88e279d547e8f26a7 ] The _nbu2ss_ep_done() function calls: list_del_init(&req->queue); which means that the loop will never exit. Fixes: ca3d253eb967 ("Staging: emxx_udc: Iterate list using list_for_each_entry") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YKUd0sDyjm/lkJfJ@mwanda Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/emxx_udc/emxx_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a6c893ddbf28..cc4c18c3fb36 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2064,7 +2064,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, int status) { - struct nbu2ss_req *req; + struct nbu2ss_req *req, *n; /* Endpoint Disable */ _nbu2ss_epn_exit(udc, ep); @@ -2076,7 +2076,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, return 0; /* called with irqs blocked */ - list_for_each_entry(req, &ep->queue, queue) { + list_for_each_entry_safe(req, n, &ep->queue, queue) { _nbu2ss_ep_done(ep, req, status); } -- 2.30.2