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=-24.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 C897FC4320E for ; Tue, 24 Aug 2021 02:57:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC52B611C9 for ; Tue, 24 Aug 2021 02:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234005AbhHXC6d (ORCPT ); Mon, 23 Aug 2021 22:58:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:52554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233847AbhHXC6c (ORCPT ); Mon, 23 Aug 2021 22:58:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0ECFC611C8; Tue, 24 Aug 2021 02:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629773869; bh=flhHQzXKNCiSDM4aaiL1rBvLmbZ8bDMjLpAFb71Pq5Q=; h=From:To:Cc:Subject:Date:From; b=U1nsy1+1DOwF493ss7rkoyXFnYewtCO3rZAg9u/qXYE6zTS5p2pZ+XAy19wwITMWJ rTvonLS1OkofFNzS3iOlt/qLp5VNm7r2NBYAeagp4MA9DpEXjfvHzcWUBUmx0zP7l9 eyD3ptco19TlQSbT+5HJ7Y/1nreVXYNN+2+SfHLS6y5qXOWTvuLZWUF3Puy6SRxirC uV1EnTVz6JdIF+rs4kHv2wiQ9/YjQbWGhzXMq42CrbiV5TqM14AjasWJ9fw8cvS0+p IzjvSMhy9cLwtjLHtEv9z7mAZNB5eNzyPGmDX1oDnpkxZzYcXYABiGN1M6b4J9IowP 4iDyBCJ8tAptQ== From: Sasha Levin To: stable@vger.kernel.org, axboe@kernel.dk Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: FAILED: Patch "io_uring: only assign io_uring_enter() SQPOLL error in actual error case" failed to apply to 5.10-stable tree Date: Mon, 23 Aug 2021 22:57:47 -0400 Message-Id: <20210824025748.658175-1-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From 21f965221e7c42609521342403e8fb91b8b3e76e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 14 Aug 2021 09:04:40 -0600 Subject: [PATCH] io_uring: only assign io_uring_enter() SQPOLL error in actual error case If an SQPOLL based ring is newly created and an application issues an io_uring_enter(2) system call on it, then we can return a spurious -EOWNERDEAD error. This happens because there's nothing to submit, and if the caller doesn't specify any other action, the initial error assignment of -EOWNERDEAD never gets overwritten. This causes us to return it directly, even if it isn't valid. Move the error assignment into the actual failure case instead. Cc: stable@vger.kernel.org Fixes: d9d05217cb69 ("io_uring: stop SQPOLL submit on creator's death") Reported-by: Sherlock Holo sherlockya@gmail.com Link: https://github.com/axboe/liburing/issues/413 Signed-off-by: Jens Axboe --- fs/io_uring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 04c6d059ea94..6a092a534d2b 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9370,9 +9370,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, if (ctx->flags & IORING_SETUP_SQPOLL) { io_cqring_overflow_flush(ctx, false); - ret = -EOWNERDEAD; - if (unlikely(ctx->sq_data->thread == NULL)) + if (unlikely(ctx->sq_data->thread == NULL)) { + ret = -EOWNERDEAD; goto out; + } if (flags & IORING_ENTER_SQ_WAKEUP) wake_up(&ctx->sq_data->wait); if (flags & IORING_ENTER_SQ_WAIT) { -- 2.30.2