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

Commit 83ad6586 authored by Wei Wang's avatar Wei Wang Committed by Pranav Vashi
Browse files

Revert "sched/core: Fix use after free issue in is_sched_lib_based_app()"



This reverts commit 0e6ca164.

Bug:133481659
Test: build
Change-Id: Ie6a0b5e46386c98882614be19dedc61ffd3870e5
Signed-off-by: default avatarWei Wang <wvw@google.com>
Signed-off-by: default avatarPranav Vashi <neobuddy89@gmail.com>
parent 9ff7cb7b
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -5067,7 +5067,6 @@ static inline bool is_sched_lib_based_app(pid_t pid)
	char path_buf[LIB_PATH_LENGTH];
	bool found = false;
	struct task_struct *p;
	struct mm_struct *mm;

	if (strnlen(sched_lib_name, LIB_PATH_LENGTH) == 0)
		return false;
@@ -5084,12 +5083,11 @@ static inline bool is_sched_lib_based_app(pid_t pid)
	get_task_struct(p);
	rcu_read_unlock();

	mm = get_task_mm(p);
	if (!mm)
	if (!p->mm)
		goto put_task_struct;

	down_read(&mm->mmap_sem);
	for (vma = mm->mmap; vma ; vma = vma->vm_next) {
	down_read(&p->mm->mmap_sem);
	for (vma = p->mm->mmap; vma ; vma = vma->vm_next) {
		if (vma->vm_file && vma->vm_flags & VM_EXEC) {
			name = d_path(&vma->vm_file->f_path,
					path_buf, LIB_PATH_LENGTH);
@@ -5105,8 +5103,7 @@ static inline bool is_sched_lib_based_app(pid_t pid)
	}

release_sem:
	up_read(&mm->mmap_sem);
	mmput(mm);
	up_read(&p->mm->mmap_sem);
put_task_struct:
	put_task_struct(p);
	return found;