[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241119150550.GB2240@redhat.com>
Date: Tue, 19 Nov 2024 16:05:51 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] get_task_exe_file: check PF_KTHREAD locklessly
On 11/19, Mateusz Guzik wrote:
>
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1500,12 +1500,13 @@ struct file *get_task_exe_file(struct task_struct *task)
> struct file *exe_file = NULL;
> struct mm_struct *mm;
>
> + if (task->flags & PF_KTHREAD)
> + return NULL;
> +
> task_lock(task);
> mm = task->mm;
> - if (mm) {
> - if (!(task->flags & PF_KTHREAD))
> - exe_file = get_mm_exe_file(mm);
> - }
> + if (mm)
> + exe_file = get_mm_exe_file(mm);
> task_unlock(task);
> return exe_file;
Acked-by: Oleg Nesterov <oleg@...hat.com>
Powered by blists - more mailing lists