Re: [PATCH 4/4] io_uring: cancel requests enqueued as task_work's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/30/20 2:34 PM, Pavel Begunkov wrote:
> Currently request cancellations are happening before PF_EXITING is set,
> so it's allowed to call task_work_run(). Even though it should work as
> it's not it's safer to remove PF_EXITING checks.
> 
> Cc: stable@xxxxxxxxxxxxxxx # 5.5+
> Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
> ---
>  fs/io_uring.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index ca46f314640b..8d4fa0031e0a 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2361,12 +2361,8 @@ static inline unsigned int io_put_rw_kbuf(struct io_kiocb *req)
>  
>  static inline bool io_run_task_work(void)
>  {
> -	/*
> -	 * Not safe to run on exiting task, and the task_work handling will
> -	 * not add work to such a task.
> -	 */
> -	if (unlikely(current->flags & PF_EXITING))
> -		return false;
> +	WARN_ON_ONCE(current->flags & PF_EXITING);

Should still include the return, ala:

if (WARN_ON_ONCE(current->flags & PF_EXITING))
	return;

to be on the safe side, otherwise it'll crash anyway if we do hit this
condition.

-- 
Jens Axboe




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux