drivers: cpuidle: lpm-levels: Fix untrusted pointer dereference.
The list_for_each macro was not used correctly, where the intermediate variable would be LIST_POISON, resulting in a untrusted pointer dereference. Switch to using list_for_each_entry_safe to for safe removal of a list entry. Change-Id: I0e0fd5dd9f251b5093d6e9d6335387512ec59249 Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
This commit is contained in:
parent
55cc722ec6
commit
5f3b521525
1 changed files with 5 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 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
|
||||
|
@ -848,14 +848,12 @@ failed:
|
|||
|
||||
void free_cluster_node(struct lpm_cluster *cluster)
|
||||
{
|
||||
struct list_head *list;
|
||||
int i;
|
||||
struct lpm_cluster *cl, *m;
|
||||
|
||||
list_for_each(list, &cluster->child) {
|
||||
struct lpm_cluster *n;
|
||||
n = list_entry(list, typeof(*n), list);
|
||||
list_del(list);
|
||||
free_cluster_node(n);
|
||||
list_for_each_entry_safe(cl, m, &cluster->child, list) {
|
||||
list_del(&cl->list);
|
||||
free_cluster_node(cl);
|
||||
};
|
||||
|
||||
if (cluster->cpu) {
|
||||
|
|
Loading…
Add table
Reference in a new issue