From patchwork Mon Dec 16 17:48:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181787 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4677496ile; Mon, 16 Dec 2019 10:27:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzLyjEhput5+VvT72eg3/l5n5titZUBVvvkeQB6RoLuRn+pgH/l8NU3GQR+V//XCgQ4/SeY X-Received: by 2002:a9d:6395:: with SMTP id w21mr33732397otk.3.1576520851320; Mon, 16 Dec 2019 10:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520851; cv=none; d=google.com; s=arc-20160816; b=V0v6GVr36dtV/090nGRl75ESmMW8wbE3sINe+JNx7UNHosEPKUQgz+9uIGhH9klad3 Mz732U45sN51b8lnkMpZ4u+UpXh7Y2gJe0rqTwYg0pEuCAc/0WD2J/tUJafQPwrAQNu1 3DOSZ6IEXsb30iC+I8ilHvK6xnMvvW9QSGXiF+vZtlR3O79yQEb4bwz07jwOaJlJeq0r Bpf2yiLByHIf/JlUBw7EbZcCWPPqZbw6hFHlL7N2aXB7Z50loPD7m5NmEds2ly8pSDHU 9HnwI49IiUF3hFAaqxWl/HDaFedVXpnuIySjqxdtBAjA9mMlNKhVKX1OSd5LLu3Tc4N8 0Pig== 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=BE75oADoImC1BV+/Ce/iPvRi8JafoJqx48gBoloWcOE=; b=FWfMMpCqMSeDPHzUbLf7pY+hwqCa5n8U7Qv4vu4lap//9jQKvMvLLEoPbJRKWbi3JC aaHlYjJq/4Ysy9yKJGKP+AFhf8laSh6dWbKHYpqiWIc9EZ/CARR6P9HIa+4NLRKS/D7t zaTiFTd/zeVPKMQMq02PdYDJF7FnzN1haJ0516IulU/JFyM806cTsx/xdcW48ygHHY+R wzve+4tqWNYhml3TzexUPDESA5+CtKgCr4Z9ZaapK5UnbysLzhKNOoOLkn3KZsmzys+o AtHB3T8HRRn8mXgjW9V6xcHYfq2kQF92Zz5usMWY6n5YbHdDQTtWdIrFgNcdpGiGl80Y DfDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OgtUP2OY; 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 16si14568923otk.151.2019.12.16.10.27.30; Mon, 16 Dec 2019 10:27:31 -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=OgtUP2OY; 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 S1727604AbfLPS13 (ORCPT + 27 others); Mon, 16 Dec 2019 13:27:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:37356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731227AbfLPSPr (ORCPT ); Mon, 16 Dec 2019 13:15:47 -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 AB25E21739; Mon, 16 Dec 2019 18:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520147; bh=tHbKCpPiGecCPTCgk3V5tn9r2fHfaJe0rvIkRctlIjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OgtUP2OYOC6AJcdiuVCAg1NiRGRcvcJw34yQP2Ai3aukBvdeDTS9EhhWxugA9Nq6I 5YOn4s82p+yUUwJN2Fp6RF/5OBIK4Si6UDYuDfvf1fEaSv/OFBVM2pgKJ/NZUvlOUG M9YNHyrcpEDLdldYf02ivVhd0RNWaRtTWndr90iU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Bjorn Andersson , Georgi Djakov Subject: [PATCH 5.4 034/177] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Mon, 16 Dec 2019 18:48:10 +0100 Message-Id: <20191216174828.234103663@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Georgi Djakov commit f39488ea2a75c49634c8611090f58734f61eee7c upstream. As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 5e4e6c4d3ae0 ("interconnect: qcom: Add QCS404 interconnect provider driver") Reported-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov Cc: # v5.4 Link: https://lore.kernel.org/r/20191212075332.16202-4-georgi.djakov@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/interconnect/qcom/qcs404.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -414,7 +414,7 @@ static int qnoc_probe(struct platform_de struct icc_provider *provider; struct qcom_icc_node **qnodes; struct qcom_icc_provider *qp; - struct icc_node *node; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -494,7 +494,7 @@ static int qnoc_probe(struct platform_de return 0; err: - list_for_each_entry(node, &provider->nodes, node_list) { + list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -508,9 +508,9 @@ static int qnoc_remove(struct platform_d { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); struct icc_provider *provider = &qp->provider; - struct icc_node *n; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); }