From patchwork Mon Dec 2 16:21: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: 180623 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp183223ile; Mon, 2 Dec 2019 08:21:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyoe2+Bx+HT0/GWUN+bJGnCQwf8XTFo6G0dWqEkbB9D+3vHJDjx6fSYaepb1mrL8ndOkxiK X-Received: by 2002:a05:600c:30a:: with SMTP id q10mr29048702wmd.84.1575303714708; Mon, 02 Dec 2019 08:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303714; cv=none; d=google.com; s=arc-20160816; b=SFZnmLaTncydbxM31NL1YSgYNMQsEgpDAN2nESPU/h0HSMu32LMnv9M6Am4Pn2oxNK eCVX0OF9jEIplF4tJFWRlBSUKwQCKGMS5eYqQqrZnJ33iiIYZ1VG/sPZon/VEwkbXbBh UzHHD4nJGIyWonKHoroh3wxUXxNUpEpUk8PPFmECkLenTsCZb+Ai3RlxXuZDqF86I1E4 t8w9/hpy4LlV+y4T6gIwo6xzGgewyKY9jIWa6g80tKq0mUbwcwod1xujvadDolkGgYn2 DBtQNs20RVecYuxRYYuCh2fke+u2eRwPjastTNAlzi1/8BzGR6m/hUQjAa2keXQlzvRP 4S6Q== 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=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=EE7tJEwvwdhPvka1QHL9YAqkobwoRhJFEdQtE+ywVBVuVVpHgFGUKSS+YqXX7k51sj Q+2QFj5NXtbzi4nrvRkTn5MQk4pikArH/L7JbJ9QHw7DDfC7jBSn/8hOpshUjbosSjlg sz/Aa/ewV8W3fdMn6z7UeR1930RfN2TaLGS3LagQha7z+5Fr2PIXBPoUcXIZHzcsvaMW zBkAnxcN+gERnANxqx6u/dL5j0/O/xpm8r8VZ+uwg576bv/0mEzZcKSpwpzxWeB8p8Cv UptPqXh47fvwUJKS141f3+nMfYtBqApF8I4sNvs971UpcmTvjxoIjDvp1zdbRuwSF1vL lgcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AP6DiGL/"; 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 bs15si22314518edb.408.2019.12.02.08.21.54; Mon, 02 Dec 2019 08:21:54 -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="AP6DiGL/"; 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 S1727673AbfLBQVm (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:42 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41715 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727634AbfLBQVj (ORCPT ); Mon, 2 Dec 2019 11:21:39 -0500 Received: by mail-wr1-f68.google.com with SMTP id b18so45062175wrj.8 for ; Mon, 02 Dec 2019 08:21: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=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=AP6DiGL/aQDTxsAfZ1x0QW+Tv8Bg7T5RqQnXQmNd2D7OmhJ/YbRW1pmAjuDOkM2Y2F 0xGdykT8B6nyEKr9akZYeTPLwCSAridNAkPznb19AHx3u9eVgUQpuDRnw5U2avBiQfG/ PnsAwETCY+nidrFK0fkulfX1bd87h+6Gsw8LOAoJjGAarWiauj0mDJq/n7ub4OV/lUPh /Ud4d9x5Siix/pN7AZQHNsAWTmwUmH0JHHp3tnAEOtg4ZeeLd+OpAB3eKgZLLRWtGIh9 KiCfqvewrsnuUXm/K+lkeJe6tEL/9+PU77gfs6Nxmtsi0y97vQHDhZPYnH4kMNgKSYiL 48KQ== 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=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=QZkkhcpW92T+OLHBPQXzm8Cr3tA/NEZQhJnCw9J/EPQvKXKdQWAcCrRdzOEunRv7n9 8BUAjLkITkvOAAmqRHys0+gi4IGG7vRXYYmA/k4YWa8e1m/WDzVoeBYMwZNVoTkLV3e3 J8d30tssEPNp7bruSFDe/5olCWLPegnAPNXZgGxLn1QoMencaX7HCGyOQFVwb12R9GOc rw66uDl21ICGQNWc9seF/EAEDZ1k0tA3MOkPtzbV/1104D5jAmTTq3890pBOaFTIuhFx lZoxtOn6TLNrr3ivKZksRBRXVeDQ9Qlu1o9LyqwR3smjY1l2DH8snvOJnRN/CUMuKzRS 7Glg== X-Gm-Message-State: APjAAAV9r8YJKDVK31FgSeYcq582G6Z+W+dvqnAthf3ngsupmtFCCFYM vvEM5uRDg/kzquiAqu7xD1Iu8js1xgs= X-Received: by 2002:adf:a746:: with SMTP id e6mr15118778wrd.329.1575303697776; Mon, 02 Dec 2019 08:21:37 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:37 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:30 +0200 Message-Id: <20191202162133.7089-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202162133.7089-1-georgi.djakov@linaro.org> References: <20191202162133.7089-1-georgi.djakov@linaro.org> MIME-Version: 1.0 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: 5e4e6c4d3ae0 ("interconnect: qcom: Add QCS404 interconnect provider driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov --- drivers/interconnect/qcom/qcs404.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index 5e5843e6bd06..9064f6bdaa69 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -405,7 +405,7 @@ static int qnoc_probe(struct platform_device *pdev) 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; @@ -485,7 +485,7 @@ static int qnoc_probe(struct platform_device *pdev) 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); } @@ -499,9 +499,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); }