public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Hao Xu <[email protected]>, Jens Axboe <[email protected]>
Cc: [email protected], Joseph Qi <[email protected]>
Subject: Re: [PATCH] io_uring: fix ctx cancellation for rings allocation failure
Date: Thu, 1 Apr 2021 10:11:46 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

> This is caused by access ctx->rings in io_ring_ctx_wait_and_kill()
> while ctx->rings is NULL because of allocation failure.

Yep, missed it out but already fixed
https://git.kernel.dk/cgit/linux-block/commit/?h=io_uring-5.12&id=51520426f4bc3e61cbbf7a39ccf4e411b665002d

 
> Reported-by: Abaci <[email protected]>
> Signed-off-by: Hao Xu <[email protected]>
> ---
>  fs/io_uring.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 1949b80677e7..03f593f5e740 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -8616,12 +8616,16 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
>  	unsigned long index;
>  	struct creds *creds;
>  
> +	if (!ctx->rings) {
> +		io_ring_ctx_free(ctx);
> +		return;
> +	}
> +
>  	mutex_lock(&ctx->uring_lock);
>  	percpu_ref_kill(&ctx->refs);
>  	/* if force is set, the ring is going away. always drop after that */
>  	ctx->cq_overflow_flushed = 1;
> -	if (ctx->rings)
> -		__io_cqring_overflow_flush(ctx, true, NULL, NULL);
> +	__io_cqring_overflow_flush(ctx, true, NULL, NULL);
>  	xa_for_each(&ctx->personalities, index, creds)
>  		io_unregister_personality(ctx, index);
>  	mutex_unlock(&ctx->uring_lock);
> 

-- 
Pavel Begunkov

      reply	other threads:[~2021-04-01  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  9:10 [PATCH] io_uring: fix ctx cancellation for rings allocation failure Hao Xu
2021-04-01  9:11 ` Pavel Begunkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox