Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9106662pxu; Mon, 28 Dec 2020 06:48:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlqJdI1yHdkiv+8D8S6aEFpyUacN4aX1LFgOgk85022Kal7lWFh2mSOCK+4tNfaQszoOAM X-Received: by 2002:a17:906:3685:: with SMTP id a5mr3036357ejc.544.1609166924805; Mon, 28 Dec 2020 06:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166924; cv=none; d=google.com; s=arc-20160816; b=pKvQP1QF9luL8a+QrBIIcqkHf76RKfjsWFfiYfDV40rnsf7kdfRsEhTTE3Wj6nFwcr 37jEPs9U39geMLkA9KXfjPca1j4BT9OPXHGaR+awIdsRVmbzQANVq7aj9UsLGPllMyiP ZyYcW61N4X9wU4hv1PcRBPOWpJi8yp36qWVKF8Vh9coyHFlc839LT6AA0Ap/FMKqzsDW thAf+f0a72Wbi2AvgncDTtSPBh2f0Qc8R3gVxxePA5gWRPO90tbmWgb5KmnxYiZUrAJ5 iUdFQh0u+AeCB8PNR3EBiGu2ho04n6w7YaH4sOFfGYh+P1VqWR0Awaz3275j0Ha2Q3ec cSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qMNW2jFcIQqASBjdi49Y2vMjEuM0a3hN2JmLpo+d0C8=; b=YGiZgw8JRBg5ncjk9EJTG25/ox6/9Fl6EmQlhXx+x8MzG70DGRMemoT4k2D773cFsH i5KIaUQhvoexJtH/341VKodExn9aEuS09MUHOV0guGb8Sa9ytZhjTRiF5QKOoyT32l68 8Q/v/gKfrlv/PSQeTZTnagrbjUn8WoHbBu8eI/Mtw58aOahODVwFf93T2i09EJ/hhlqx jQwRiFOJ0diQyu58exAlYLfyWcfwLQ32ZSG0OI0pOconQWJmrkXn8+R94mdjTa9jc6wF aHVV47fr5BR5gMdWyCoDnAK/CUm+Si0Sm8T9IFEQ6l1RoEMa28H9inLC+AElLetZtav1 4B8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rYIfue9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa14si15603336ejb.54.2020.12.28.06.48.21; Mon, 28 Dec 2020 06:48:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rYIfue9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408386AbgL1OqY (ORCPT + 99 others); Mon, 28 Dec 2020 09:46:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:59756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502967AbgL1OYC (ORCPT ); Mon, 28 Dec 2020 09:24:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2895720791; Mon, 28 Dec 2020 14:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165426; bh=0jDFRuMUyj3LIlnyNKUrkd5ogxo0CDxpR9NwgW+B4o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYIfue9GDSEZrkagNbx+FEaQw0Ie1bMgv21CxZEX3iYPbsPidKCbhQD33hDn3h9ic sNe6xwJkfz6W+jTx3Xq39iD29No5y0VDDMKfE/hxxi9szmulb5ZcZThi190qPuOoZw s209hiyUpaif6Iz7uUFNfcLYYGQ3DvX7t5hi3Ih0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.10 510/717] io_uring: fix io_cqring_events()s noflush Date: Mon, 28 Dec 2020 13:48:28 +0100 Message-Id: <20201228125045.395675197@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit 59850d226e4907a6f37c1d2fe5ba97546a8691a4 upstream. Checking !list_empty(&ctx->cq_overflow_list) around noflush in io_cqring_events() is racy, because if it fails but a request overflowed just after that, io_cqring_overflow_flush() still will be called. Remove the second check, it shouldn't be a problem for performance, because there is cq_check_overflow bit check just above. Cc: # 5.5+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2242,7 +2242,7 @@ static unsigned io_cqring_events(struct * we wake up the task, and the next invocation will flush the * entries. We cannot safely to it from here. */ - if (noflush && !list_empty(&ctx->cq_overflow_list)) + if (noflush) return -1U; io_cqring_overflow_flush(ctx, false, NULL, NULL);