Skip to content
Snippets Groups Projects
Commit ba61f887 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian Committed by David Lin
Browse files

drivers: qcom: lpm-stats: Fix undefined access error


In cleanup_stats(), a freed memory pointer pos might be accessed for
list traversal. Switch to using _safe() variant of the list API to
prevent undefined accesses.

Bug: 79421260
Change-Id: I7d068cb7813ccb9bfdbcab4646b4ec890145828a
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 2ff1a826
No related branches found
No related tags found
No related merge requests found
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, 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
......@@ -590,11 +590,14 @@ static void cleanup_stats(struct lpm_stats *stats)
{
struct list_head *centry = NULL;
struct lpm_stats *pos = NULL;
struct lpm_stats *n = NULL;
centry = &stats->child;
list_for_each_entry_reverse(pos, centry, sibling) {
if (!list_empty(&pos->child))
list_for_each_entry_safe_reverse(pos, n, centry, sibling) {
if (!list_empty(&pos->child)) {
cleanup_stats(pos);
continue;
}
list_del_init(&pos->child);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment