Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp517933ybl; Wed, 11 Dec 2019 23:54:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzC4w09JKVIezA0DdV8b/gLmiUQrPouro565AKt46F0dL/BO9gzIx4g+S7DQaeoUlfyepWT X-Received: by 2002:a9d:76c5:: with SMTP id p5mr7070419otl.61.1576137271091; Wed, 11 Dec 2019 23:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576137271; cv=none; d=google.com; s=arc-20160816; b=ut3xrctcdyUHtK1+yiYIapi4Ne4IW3/J/z1V/YPZeACqNW3l/MYXTlOl3cgBUU3G1W He5eImYw02iX73c7SH56IGw+yUIYICX+k/aWRVBQbdPFQubnR+u08d3cSyRO7JtI4XMp rM2mJJdQrhIg1gG74aZiixjVNjaKoxEBwkfAWBHsvr/1tga0jBzJHRnaSWbqA8VZpUmt iMV5EVOuMab+SHbadQoDufUz/ZkCESq+V7FJRSnsH4FZi/TWq3yb5/M4nAjUkfFjxSyP DAYUhhsY3gDzXfT7MK1g6qtgbwvazhB1v7AD9N/EQtHh15wtASCu688TTcaRS5GP+lLM KrLw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L7tBmXs8szR5coP2QPrIYVtp6Vuz4hm1y2XfuDFevyM=; b=xcwZJnv6RBV18Q+3BkVDRUXfuRaASaFzHS8aMYeqHBBuaBiJlLh6vEkzMOtdA+ncHG Uk4mL+Z50feVBoBh7pt9RtQvfEIDy4bAmEXAKIb+LgJBmR5pvPuCU73ER/v8hIHmQhNo tASsf41/B01mcnCszgEK0YULme/yD9N9rkZyX+s/0r7nFXgHHfanCrqMnCnfvRSruf82 nVeanbcpquR8EVHzXGAFON+icGGtH4llP38THW+juECb7rrgpp2RGzVuMbSlKhgo8kDn EbTuVhaUK+XHFFN20gpGYsWaFu+Oh5x+OrJjk/9BkEH5KWmLMC9FDCK61aGDmj0+RNpF 6yFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kr+KUFJN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si2726431oih.217.2019.12.11.23.54.19; Wed, 11 Dec 2019 23:54: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=@linaro.org header.s=google header.b=Kr+KUFJN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728220AbfLLHxo (ORCPT + 99 others); Thu, 12 Dec 2019 02:53:44 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40107 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728099AbfLLHxj (ORCPT ); Thu, 12 Dec 2019 02:53:39 -0500 Received: by mail-wr1-f66.google.com with SMTP id c14so1589489wrn.7 for ; Wed, 11 Dec 2019 23:53:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L7tBmXs8szR5coP2QPrIYVtp6Vuz4hm1y2XfuDFevyM=; b=Kr+KUFJNBXKZ6arLp7UE3PERZN82b7n76/zlZDLkUpneYqY1PlQefWZYnLdmknkRl9 HoH8gkaIpCmD33VV4YTrIflwwLBELrHVheSzqqa3J/PWyeLNzGzVGQPqU9HRUPP7QC2O Fr4dwQfTrmWSmrX+OuF3XbJUOUO7OJt0ANf+89QLKhqt5huFkZnT0vF0Qgn2Sa5B1bf9 pqMhCG/4EanSoyZpSC5X/H2FLj6SPEeyBlBGBctaWcXeKOhGOiEy8dR74wZbsciAEQLW bNka3AnfcEA+razqnulyyZDR9SLHWBVDWbjBqegStGryfu/Km6BBERbAp1Wpj0YWk7Nn fmAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L7tBmXs8szR5coP2QPrIYVtp6Vuz4hm1y2XfuDFevyM=; b=ECS1KiTWPPOqHAOL1NIcLKpYWEEGWG6HV+UaAQKLE3isNVvnvHJwAVfu04AcwOvF6r 5ogZ1Ix/VSAAFd7pwq4LFuL6R2nL2TO2TLs/Lpr5S3ljxs9C64xVb5zWhQhQ5vDjGhbi 0CcYw4OB8fbI4tncKrVnxzBCGUq8n7GJQukbzHLyxQgzob1ZSxdVj/0g1ysyrn0e/6qw DTlmSxi4cx+ee/+tBVW/mWsjXz2jbIyaffmI/nDgrckkoKWQ+YQF5S5jqyGql+SlaYe3 SpKGS+mckk5kI9OP2xgKUvpuYxWuj48SVob3lFqFu8PF8TslJfe1wDwA/1PYUv0lC38p AJ+g== X-Gm-Message-State: APjAAAXv5Wndu6QTuPA3jtJnacrn1QxdHtNtae5Ehf6VHqd82f1cHpER YVFPv3dpDtkDvFGqoGZ8khuQdg== X-Received: by 2002:a5d:53d1:: with SMTP id a17mr4430038wrw.327.1576137217821; Wed, 11 Dec 2019 23:53:37 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id x6sm5636742wmi.44.2019.12.11.23.53.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Dec 2019 23:53:37 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov , Dmitry Osipenko , Bjorn Andersson Subject: [PATCH 4/4] interconnect: qcom: msm8974: Walk the list safely on node removal Date: Thu, 12 Dec 2019 09:53:32 +0200 Message-Id: <20191212075332.16202-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191212075332.16202-1-georgi.djakov@linaro.org> References: <20191212075332.16202-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 4e60a9568dc6 ("interconnect: qcom: add msm8974 driver") Reported-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov --- drivers/interconnect/qcom/msm8974.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index ce599a0c83d9..bf8bd1aee358 100644 --- a/drivers/interconnect/qcom/msm8974.c +++ b/drivers/interconnect/qcom/msm8974.c @@ -652,7 +652,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - struct icc_node *node; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -732,7 +732,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) return 0; err_del_icc: - 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); } @@ -748,9 +748,9 @@ static int msm8974_icc_remove(struct platform_device *pdev) { struct msm8974_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); }