Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp212535ybl; Mon, 2 Dec 2019 09:39:26 -0800 (PST) X-Google-Smtp-Source: APXvYqy9Mzf1X7bHr6T8cW6GjvjWfMx0pehURQAenIZzfVkhwuzY8kHQapMZlpGMAQt/07S7awsK X-Received: by 2002:a50:eb4d:: with SMTP id z13mr64589863edp.263.1575308366387; Mon, 02 Dec 2019 09:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575308366; cv=none; d=google.com; s=arc-20160816; b=fWx3iPx2FKCmxexbY0t11EpMz64Umxze0OOcAxrjW8a+ZEzu2o/m3TG9xNncW4r601 AKBakp9kJS3xsoKTLNhittaZ00QyEcr2O6euKUSGaXU12mM+6MAE6WvuPNSCIc2sQstI jOgOn/Qg1mh9uLnnDprxVJB9nLuiRD4jrWegYlvvZHp8+14oyHnNH0fqn6w4w7MYPKID tK9Q7eoG0wK7lwpzqtI33B34aqgBVsLfpHlNnBDhMH/9it3QimvhyRQudQyTY+VhvY0k 13QFoFsvwbioOu0oXJBfkHdQaAAO5485mWSacVVOyk2SqgAWyEdUOn4do7bUwfiOPyN/ dJ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Lio+2kp4wy6jj0nVNYlYlFqccYHlkpvhpP9pJwIiJYw=; b=tIEXVZJBB6BPjFIZseX8nj1lccgEvfmkP6n9svxi5gSJqGNloJfu4a0G7RAq2GHQhx YpMjfzsHfFB/3uawCM3+lD9iR3CAi5VPb9LKR9fp0i+ivh4m7Oi6dLH2BEMNdDHnACgg kxaoi58P/iuhplmXra4DDbfEtLaXW8F5+UOTPFRPynXmKEovoK0YZZP9eogjqEmhiMGg 3fddHwFhmJegRnwExfgG6AVb1Klwwu/HPAY8jNx3gjqSbM3j1ba9oeSYIoSU4E2vY6VI EoYGgvHipz2sJSTePNIDcMGgm3xEVaFKWLKFtcy/U0FBWHSWWzvzEzxQrDScgrwSuRNO GKlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GfEK9ER1; 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 g7si34876ejr.267.2019.12.02.09.39.02; Mon, 02 Dec 2019 09:39:26 -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=GfEK9ER1; 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 S1727870AbfLBRhZ (ORCPT + 99 others); Mon, 2 Dec 2019 12:37:25 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33753 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbfLBRhZ (ORCPT ); Mon, 2 Dec 2019 12:37:25 -0500 Received: by mail-pf1-f196.google.com with SMTP id y206so10141pfb.0 for ; Mon, 02 Dec 2019 09:37:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Lio+2kp4wy6jj0nVNYlYlFqccYHlkpvhpP9pJwIiJYw=; b=GfEK9ER1iXcxBhlq61EilfAMcKofLSDC9W2o85uPKvDzj9lH+stqhUMOQOJ5gPF7j/ cPF+hvtuEiRrUt4xwz7VGxHt5dZvdf5DniPiIX81i6NaHt76te7FVpnRA10LnWUKLEb9 PYmPOQ40EGdkTDZ1Q5xgwv+J9ymj0AJspngh74y4xTkmdH/N0KazI+edw5R4jfQcyYm2 FT4Ll3kuF2oRIQmSfoXCkW9K2prYA0kxohCix2SB8eL9DGJnDyz98p3lzsDbm67nB/eX viGYnI0FJ0Iz7m7SHQnuyzH/ghctHJ3CvGNpm9tA7hM0tqLbz0sNyWDjo8Ji90v0Ourm 8Ggg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Lio+2kp4wy6jj0nVNYlYlFqccYHlkpvhpP9pJwIiJYw=; b=BIyAI1j3OpCsf91oo3Y0sBJ1jOO3dBm3k0mZ1JPJ3iwRqTch53Vub2wDuDe/DMiVqL +X8n2Deobe0d4UFVDDRFVgZE6jZKBX7OH5J9ayMOdFISJRLwEaTghtmO5U7oW4drV3Ch VsVpvvRJz2+bLhbi9nDgxq+XDn/yMtlwZCC2YQjfTTxIf266y2KPofsXlEF/ZnZCrzJX iaYwMthZFOayPMF2P+YzKeumtK4PGhUBPiILjvrv39K5E62qqf1wmOCbVNXmpQyq0L/9 KRPKg6EIsYsPBBE2J7Y0xohVITuUF6DIf1jBQvsdneZFPzwpwMkPVmaTcD+uFdnvKp2l Nrbg== X-Gm-Message-State: APjAAAXnpzSCSIKw6O3sYTwD34Emrt51dSqKr2bjXd2l48QGC7xl5YUh Vk5gEqglWxn/A5a6pOV/PL96EQ== X-Received: by 2002:a63:fc09:: with SMTP id j9mr190881pgi.272.1575308244568; Mon, 02 Dec 2019 09:37:24 -0800 (PST) Received: from yoga (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id f69sm37653pje.32.2019.12.02.09.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 09:37:23 -0800 (PST) Date: Mon, 2 Dec 2019 09:37:21 -0800 From: Bjorn Andersson To: Georgi Djakov Cc: linux-pm@vger.kernel.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 Subject: Re: [PATCH v2 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal Message-ID: <20191202173721.GC133384@yoga> References: <20191202162133.7089-1-georgi.djakov@linaro.org> <20191202162133.7089-2-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191202162133.7089-2-georgi.djakov@linaro.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote: > 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 Reviewed-by: Bjorn Andersson > --- > 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); > }