Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 612bd368 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched: walt: fix use after free in walt_task_dump()"

parents 42a3bb39 aaa6f4ce
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __WALT_H
@@ -364,6 +364,15 @@ static inline void walt_rq_dump(int cpu)
	struct task_struct *tsk = cpu_curr(cpu);
	int i;

	/*
	 * Increment the task reference so that it can't be
	 * freed on a remote CPU. Since we are going to
	 * enter panic, there is no need to decrement the
	 * task reference. Decrementing the task reference
	 * can't be done in atomic context, especially with
	 * rq locks held.
	 */
	get_task_struct(tsk);
	printk_deferred("CPU:%d nr_running:%u current: %d (%s)\n",
			cpu, rq->nr_running, tsk->pid, tsk->comm);

@@ -388,6 +397,7 @@ static inline void walt_rq_dump(int cpu)
		printk_deferred("rq->load_subs[%d].new_subs=%llu)\n", i,
				rq->load_subs[i].new_subs);
	}
	if (!exiting_task(tsk))
		walt_task_dump(tsk);
	SCHED_PRINT(sched_capacity_margin_up[cpu]);
	SCHED_PRINT(sched_capacity_margin_down[cpu]);