stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, stable@vger.kernel.org
Subject: Re: [PATCH backport 5.10] io_uring: close a small race gap for files cancel
Date: Wed, 30 Dec 2020 16:30:41 +0100	[thread overview]
Message-ID: <X+ydIQfWLELe4IfF@kroah.com> (raw)
In-Reply-To: <c47ff9d5a4dadaaa47fa2f2ad2f6cae8c39a9b98.1609215832.git.asml.silence@gmail.com>

On Tue, Dec 29, 2020 at 04:35:49AM +0000, Pavel Begunkov wrote:
> commit dfea9fce29fda6f2f91161677e0e0d9b671bc099 upstream.
> 
> The purpose of io_uring_cancel_files() is to wait for all requests
> matching ->files to go/be cancelled. We should first drop files of a
> request in io_req_drop_files() and only then make it undiscoverable for
> io_uring_cancel_files.
> 
> First drop, then delete from list. It's ok to leave req->id->files
> dangling, because it's not dereferenced by cancellation code, only
> compared against. It would potentially go to sleep and be awaken by
> following in io_req_drop_files() wake_up().
> 
> Fixes: 0f2122045b946 ("io_uring: don't rely on weak ->files references")
> Cc: <stable@vger.kernel.org> # 5.5+
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>  fs/io_uring.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Now applied, thanks.

greg k-h

      reply	other threads:[~2020-12-30 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1609215832.git.asml.silence@gmail.com>
2020-12-29  4:35 ` [PATCH backport 5.10] io_uring: close a small race gap for files cancel Pavel Begunkov
2020-12-30 15:30   ` Greg KH [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 \
    --in-reply-to=X+ydIQfWLELe4IfF@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).