summaryrefslogtreecommitdiff
path: root/drivers/power/qcom
diff options
context:
space:
mode:
authorJohn Zhao <yuankuiz@codeaurora.org>2018-01-30 22:41:57 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-02-06 06:25:17 -0800
commit819b1faf1244b60a9b50a5f48078f449485d79e6 (patch)
treee9f79d73a40ab4499a7fe4dd45cfb765947cca24 /drivers/power/qcom
parenta7e3f3f2de950836d52b6eeb4c4f1934dd7f89b4 (diff)
lpm-stats: cleanup lpm stats processing sanity wrapping
during list_for_each_entry_reverse iteration, cleanup_stats recursively on current operated stats node could result it will be freed at the end of that cleanup_stats progress. De-referencing it again should not happen. CRs-Fixed: 2182622 Change-Id: Icf837b0aa796fed5fe1721f9fe66fd0dd36ccfd7 Signed-off-by: John Zhao <yuankuiz@codeaurora.org>
Diffstat (limited to 'drivers/power/qcom')
-rw-r--r--drivers/power/qcom/lpm-stats.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/power/qcom/lpm-stats.c b/drivers/power/qcom/lpm-stats.c
index d3cafc411a77..90458d6a7212 100644
--- a/drivers/power/qcom/lpm-stats.c
+++ b/drivers/power/qcom/lpm-stats.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, 2018 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -685,8 +685,10 @@ static void cleanup_stats(struct lpm_stats *stats)
centry = &stats->child;
list_for_each_entry_reverse(pos, centry, sibling) {
- if (!list_empty(&pos->child))
+ if (!list_empty(&pos->child)) {
cleanup_stats(pos);
+ continue;
+ }
list_del_init(&pos->child);