From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5147C433DB for ; Wed, 30 Dec 2020 15:29:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8246222227 for ; Wed, 30 Dec 2020 15:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726322AbgL3P34 (ORCPT ); Wed, 30 Dec 2020 10:29:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:42526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbgL3P34 (ORCPT ); Wed, 30 Dec 2020 10:29:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E782B207B2; Wed, 30 Dec 2020 15:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609342155; bh=je+exU43lr3MB3kMbRTXOz2v5D4Il5Vuz9obRPrmbWo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fyXjC8apMi70xiRjf2knNjsis/XIfoK1b/GMaZ9ojHX9PkcKQ0KE1GlGRQQITXujU sdR0fnfGqbhag7wfqO/t/5pwWSsd3g0yCjDkpAox0moEW8mWVGDiH/fisAwm3gmR9W 05Ku7cHdkU4PhkeFbBBXXt24z00tMWTFcVYGwAD4= Date: Wed, 30 Dec 2020 16:30:41 +0100 From: Greg KH To: Pavel Begunkov Cc: Jens Axboe , stable@vger.kernel.org Subject: Re: [PATCH backport 5.10] io_uring: close a small race gap for files cancel Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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: # 5.5+ > Signed-off-by: Pavel Begunkov > Signed-off-by: Jens Axboe > --- > fs/io_uring.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Now applied, thanks. greg k-h