Skip to content

Commit 3e42fe5

Browse files
Georgi Djakovgregkh
authored andcommitted
interconnect: qcom: msm8974: Walk the list safely on node removal
As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 4e60a95 ("interconnect: qcom: add msm8974 driver") Reported-by: Dmitry Osipenko <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Georgi Djakov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f39488e commit 3e42fe5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/interconnect/qcom/msm8974.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
652652
struct device *dev = &pdev->dev;
653653
struct icc_onecell_data *data;
654654
struct icc_provider *provider;
655-
struct icc_node *node;
655+
struct icc_node *node, *tmp;
656656
size_t num_nodes, i;
657657
int ret;
658658

@@ -732,7 +732,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
732732
return 0;
733733

734734
err_del_icc:
735-
list_for_each_entry(node, &provider->nodes, node_list) {
735+
list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) {
736736
icc_node_del(node);
737737
icc_node_destroy(node->id);
738738
}
@@ -748,9 +748,9 @@ static int msm8974_icc_remove(struct platform_device *pdev)
748748
{
749749
struct msm8974_icc_provider *qp = platform_get_drvdata(pdev);
750750
struct icc_provider *provider = &qp->provider;
751-
struct icc_node *n;
751+
struct icc_node *n, *tmp;
752752

753-
list_for_each_entry(n, &provider->nodes, node_list) {
753+
list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) {
754754
icc_node_del(n);
755755
icc_node_destroy(n->id);
756756
}

0 commit comments

Comments
 (0)