From patchwork Thu Dec 12 07:53:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 181456 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp563765ile; Wed, 11 Dec 2019 23:53:56 -0800 (PST) X-Google-Smtp-Source: APXvYqzJjW7mZNQrKGQH4xD99a1UpkI4FBOi57tcKlUyTafkrRr5yPNAeGItJNT8Uy+MDjBwJGk2 X-Received: by 2002:a9d:7f11:: with SMTP id j17mr6942569otq.281.1576137236442; Wed, 11 Dec 2019 23:53:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576137236; cv=none; d=google.com; s=arc-20160816; b=co7E3xc0ZEJ/iB33FQ0apndGOkO7leN99LnhF1vlCuGnfIKGU+2jmyt1kSAuRG9ZEp pyl6OVe8wqxvxXT9GR4nwN/Rv92DkM4C54DqPh5ojS906uWKyhkPDdHc71ViAJbbiUh7 qoZ0o284D9Z9zzuiPiEMEfI9QEMyw/JOocKpfBtW093jHv2kmZgpwJx+Hd7Vx7E7KOTA p3By/xK1uXQiJ1qYTTIYX5T8GRa3No6iUPWjGIQcP7O8CC/ejTfI0DmcD81/0sNUstCl PM4X0wwNKhpO4AY2QoTT57VHJW/YF58TwgC3GvIkaTm6i33vkCYZffNeW67aOCXuAy/g P2og== 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=y0w6MnW3oZvs4i15UPLA0/120XiFldb3t4/pTdGFLw0=; b=aI9N71FzZIZRKxXvcwiSAqyB6Rq76cJLxCo0PhG00ZVuDS7cNYXTrJI2I9Qbi8TfFr m3Q6bQQqt7EJgBNcKblSjwYwKBiBcyB/eLeyEReLzB10nI/ufbrvdJriynlRCcTu+DV+ 4l5U3PZ1DuDzcX2gTQqa5IgkzF5P29JxxFXFW+Xb3dF76bp2AadoWGQh9n+ZLZN6GXS5 wmiWHG5D3BDZpXT9vVbud2W5As5F8OTxSAiO9QafEEC9pRgxEIpUlxA/faGQ0Dn2AmDC zhURaFhPRPJWyp0Ar8Dkc+KE5U49fdY4hqUzv2c1MtWG3g8nXITyvnwEPD5rQ7RY4ZMA 3CXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E6CVo+lY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 z23si2523528otk.166.2019.12.11.23.53.56; Wed, 11 Dec 2019 23:53:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=E6CVo+lY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1728157AbfLLHxz (ORCPT + 10 others); Thu, 12 Dec 2019 02:53:55 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43629 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728186AbfLLHxh (ORCPT ); Thu, 12 Dec 2019 02:53:37 -0500 Received: by mail-wr1-f66.google.com with SMTP id d16so1570581wre.10 for ; Wed, 11 Dec 2019 23:53:36 -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=y0w6MnW3oZvs4i15UPLA0/120XiFldb3t4/pTdGFLw0=; b=E6CVo+lYFHxy1yyahd2inU7r/9j3l2DqXTlgipfrVkba/Jl2TfefTcPbRpdk8V0joZ RrByorq//rGjnAx9dl6Ds8d1hVHQMVMJhvfdTct0nw8PWLMrJaKjYptNvapLIHAVomiz htwxe3N2JqfqGEKKiwiKorD6j6mdVm2KOQ0LcE2wIhLBC95mCMriqAdgeqfUuFHLYPRG W2nGPHGhJftyqpmKGwVDVn2lyCd5W+kjHCKKGS2g/LmLrLlb6lKDCxtXaXGsTF1cPYXR Yf9L/yBYDWcK+0GKQScCuQCENTeoDQoNRHAP1miPGeCYcuScpp8xi3XL/JJ+p+ctcJ0W z9vg== 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=y0w6MnW3oZvs4i15UPLA0/120XiFldb3t4/pTdGFLw0=; b=WpFIwKfgazpiO6cJElscunKCwEgyrGJe3G8f8MrCBLJDUNSoRfQzd4nwoaPadH/oE4 V9vJ3vjDAkcYcht1m/8Et7mzTBPcr5Cub6AJT2t0j96ieSXzmnbAyII3nDUTIRn8+ZRh 9YB2lz/dNKkAOBS26dSuwuqiT4TwTtmNwMghIop+tpUfKNOhvHOtnvFC4HFZEu6st2Rn z3z1kpij9rl1H1tWydXHITeFbijn/85YDtKS4HnszTqQ50fP9qBFO23Vqvro8m5nbywO GaKR49jN3sSGG9GZktLTFZV9MH9a+cmmdkn8XZP/joZCxea2bzFbhM56N8CHlceGBLEg Ft4A== X-Gm-Message-State: APjAAAVNlaVO7jvZEIHzpTx5GpoY8K+aSj5ckh2W5HZaq/aRdyZluT6Y xrmKiggBhLTL2xy3sOqlcDqXgg== X-Received: by 2002:a5d:5708:: with SMTP id a8mr4838423wrv.79.1576137215643; Wed, 11 Dec 2019 23:53:35 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id x6sm5636742wmi.44.2019.12.11.23.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Dec 2019 23:53:35 -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 , stable@vger.kernel.org Subject: [PATCH 2/4] interconnect: qcom: sdm845: Walk the list safely on node removal Date: Thu, 12 Dec 2019 09:53:30 +0200 Message-Id: <20191212075332.16202-3-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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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: b5d2f741077a ("interconnect: qcom: Add sdm845 interconnect provider driver") Reported-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov Cc: # v5.3+ --- drivers/interconnect/qcom/sdm845.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 502a6c22b41e..387267ee9648 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -868,9 +868,9 @@ static int qnoc_remove(struct platform_device *pdev) { 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); } From patchwork Thu Dec 12 07:53:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 181455 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp563621ile; Wed, 11 Dec 2019 23:53:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxeApx8Nf34gfx24DX+TGnAe8yX8z2qNUCPDpSSro+AsF/vB6r3tLPboNRGINp6hzWGqFY0 X-Received: by 2002:a05:6830:1407:: with SMTP id v7mr6962100otp.58.1576137223408; Wed, 11 Dec 2019 23:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576137223; cv=none; d=google.com; s=arc-20160816; b=M1MyxLAKFBMf2NzWo8+LHNJzbORJFfKZh1mqZPfV8EY+aRZbayTyO1bETrgiecZDx4 n7cOi3tE2+5IHtFu3KPEJ8SVv4V/0o6ieAhiJueH1kf46/STYGHsFiAB3VuPy/6ULwZ1 rtv8FPK6uAOCBf6ILC7gTpj7aHTJwVaPh5j5OQ0GojmBSEyvcWH33/0cP7kb4KUm3+i6 rtQSg2w2JJCy38DJHFWHTN0z3rN1sm3ggK5lVFxZhJdW03s02o5TXh6l0zSimR/IW/md RIs8j+RhH+iZXarth6AMQVy0vwxsDygA+BByOMcgm4r6S7QxdYtwrKTTRF9h9HFQPxp0 qcDA== 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=IRls27uwkxqyb04opJEWlAi0wUnfcHGBpD8T8mYh6qUJUd5aAxFwfKJbEB7/t5K+dA MK7tWuNcxxmzNEPpeJ49KNzlIWXunT/XHbCOtW7mVsHrvLnr49EASIsy6RpDNO71RsPo 3RB5a9TzoY+FOht1+LtekxpPaeIDczXk9hLKR3++XpipAIw/BbOtdLB2SgWrXYT86JFC nwQJSb5fcliTYN44d2FNYMopMEO0gN2Ui/mf1rpx+Tx1esvtHX3GD2pnVG/lmo+yGJa4 iLRmYOY8Lc3QFupcpx8GeL3RGixxD+CT4+yjCzvd7iH5Dz4xGS6LMfWEjjIwezM06m/l kaew== 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-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 m12si541832oic.88.2019.12.11.23.53.43; Wed, 11 Dec 2019 23:53:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1728191AbfLLHxl (ORCPT + 10 others); Thu, 12 Dec 2019 02:53:41 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38224 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbfLLHxj (ORCPT ); Thu, 12 Dec 2019 02:53:39 -0500 Received: by mail-wr1-f65.google.com with SMTP id y17so1604106wrh.5 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=KtjXbWTQGt5Ui1HevFth9vKpgqK2FfxH6Rs9FBWqYFR72jbqhj6myaqNpEeHngzLus /d6eoNoDMNHGk6QuTF/FdXkIp860Ua9dAhN66X0+N/014pYVvvsEv6D+mSJ4VWtzda3S eCQ6fmOz2kJMLwvyk6NsvYVRnAqsLuGNNYhMtq3+V4eyMJ8Q4Kj8trVX99dc5G46vB8G +TwBAwi4mV8QrPrkAi1qpn27Hj5xofRJtFxtQWujUt8EHIuaqTHlTskEUUrZGtgJASrg /wMj90+GQ5WMmQF1FvbCZNQU08GsHLnvxFM552/2UOu7aVFHEMXnyy2877Jvl0E+ztf+ 9Ckg== X-Gm-Message-State: APjAAAVueRnU0oMsPzaAquc42aWxddR0yOwd629+2dNSFIHLDOB+NwuF Mlb6ZWLXOJoNQNarZ0iWznELXw== 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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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); }