| Message ID | 20260915-work-fd-reserve-unify-folded-v1-33-4d5217d6b246@kernel.org |
|---|---|
| State | New |
| Headers | show
Return-Path: <linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ytkgj9KL; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QShSpSCR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hkg2t4jczz1xyP for <incoming@patchwork.ozlabs.org>; Tue, 15 Sep 2026 21:36:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pxEqEz5lS4vL9I4ACD8ZuCCIfu35jqQKOoRY84XHb8E=; b=ytkgj9KLKKq6LH YKTfqwUxU2V/Oten+Fk8TravMiOGzv7qtfB1Gs70tLR1sj0JG1/mHXA2KyKmpDZ8jzIi67C/yyb69 lHGVRRphn106Pw6LLlqerNqxZh2HpSeUta83dgQepe4Lw7+LWVNFWzLwnYp7KN+fSE/ZWTofCsWfg QaUmP3+gvbWNWunlXCN2tlgYdkDzmTtNuEXMkNXae9EBC2p724jJg8QlqERnXwVLf16R772kXF8Na L956gnVCa+tWMlb2xcFd5Qwc5P+aJRZzos8MxlZu8nh+ncyaI59nvp54O1pL7CpE4x1iRUwjnuH0w kcz2NWOgZDmydRqvMurA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6RSm-00000006D4T-1lgY; Tue, 15 Sep 2026 11:36:36 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6RRn-00000006CAR-1Pte; Tue, 15 Sep 2026 11:35:35 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 194BC41253; Tue, 15 Sep 2026 11:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 855EE1F000FF; Tue, 15 Sep 2026 11:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789472135; bh=4cyWZY3NqovxpRDY6IE9b0iFSwFNHI0DbK45a85UipQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QShSpSCRD6Ol4MQvbWaGFCrC9D2hEvMMsqJVxbgperwaAzfDuHUwR651hhvjbuklD V8TQMFUcMD9eSXSMuyAwgiWFzi0aqbkjT2ga+ukHQTd+ooSqbRR0w+8dklcQllx84s J1vd1rrkg7W2xCcJFOtsGmjuUfysGb2g+4rZjFbqLWmyJ8Yf8Ww523QPYOM4gdlVYe 9qjw6VvRm1T5endGkraMKVYh3kIi8DvPoXM1B76VPl1ZetouR5ZWcWZs/UQmu4oEg/ QeIQWjAGAMnj1aiLn/FeAtI3+y0er7L+q8OA2u/+KtDir8seIk/RUJip7Wgf4oA2Ys w5GYgWQdLMU4Q== From: Christian Brauner <brauner@kernel.org> Date: Tue, 15 Sep 2026 13:31:19 +0200 Subject: [PATCH RFC POC 33/50] io_uring/zcrx: install the exported descriptor when the request returns MIME-Version: 1.0 Message-Id: <20260915-work-fd-reserve-unify-folded-v1-33-4d5217d6b246@kernel.org> References: <20260915-work-fd-reserve-unify-folded-v1-0-4d5217d6b246@kernel.org> In-Reply-To: <20260915-work-fd-reserve-unify-folded-v1-0-4d5217d6b246@kernel.org> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jann Horn <jannh@google.com>, Jan Kara <jack@suse.cz>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oleg Nesterov <oleg@redhat.com>, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, bpf@vger.kernel.org, David Airlie <airlied@redhat.com>, virtualization@lists.linux.dev, kvm@vger.kernel.org, kexec@lists.infradead.org, linux-hyperv@vger.kernel.org, "Christian Brauner (Amutable)" <brauner@kernel.org> X-Mailer: b4 0.17-dev-db0b7 X-Developer-Signature: v=1; a=openpgp-sha256; l=1536; i=brauner@kernel.org; h=from:subject:message-id; bh=g4cMNX/82jJQalDLSwX1Nity2yqjS0J0NiJHAB23CT0=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWSt1Kk73H60xLL/uL9c1Ubz66I7n/6tuiXcUVn6/cZhl 7opP+8pdJSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAExk/weG/3mbVB0z75nsf+2g kJwuHDdbwrosi1P7+cq1bOytTdFl1gz/Y3eZWfw1evMxy/980nMezqvh6nqrq+2qsnZHrDSbM9O WEQA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors <linux-snps-arc.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-snps-arc>, <mailto:linux-snps-arc-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-snps-arc/> List-Post: <mailto:linux-snps-arc@lists.infradead.org> List-Help: <mailto:linux-snps-arc-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-snps-arc>, <mailto:linux-snps-arc-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" <linux-snps-arc-bounces@lists.infradead.org> Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
| Series |
file: handle files on syscall exit
|
expand
|
> Rely on the fd exit path machinery. > > Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Sashiko has reviewed this patch and found no issues. It looks great!
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index 1b3b11405dac..d458c614c765 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -795,8 +795,6 @@ static int zcrx_export(struct io_ring_ctx *ctx, struct io_zcrx_ifq *ifq, struct zcrx_ctrl *ctrl, void __user *arg) { struct zcrx_ctrl_export *ce = &ctrl->zc_export; - struct file *file; - int fd; if (!mem_is_zero(ce, sizeof(*ce))) return -EINVAL; @@ -804,27 +802,18 @@ static int zcrx_export(struct io_ring_ctx *ctx, struct io_zcrx_ifq *ifq, refcount_inc(&ifq->refs); refcount_inc(&ifq->user_refs); - file = anon_inode_create_getfile("[zcrx]", &zcrx_box_fops, - ifq, O_CLOEXEC, NULL); - if (IS_ERR(file)) { + FD_PREPARE(fdf, O_CLOEXEC, + anon_inode_create_getfile("[zcrx]", &zcrx_box_fops, ifq, + O_CLOEXEC, NULL)); + if (IS_ERR(fdf)) { zcrx_unregister(ifq, NULL); - return PTR_ERR(file); - } - - fd = get_unused_fd_flags(O_CLOEXEC); - if (fd < 0) { - fput(file); - return fd; + return PTR_ERR(fdf); } - ce->zcrx_fd = fd; - if (copy_to_user(arg, ctrl, sizeof(*ctrl))) { - fput(file); - put_unused_fd(fd); + ce->zcrx_fd = fd_prepare_fd(fdf); + if (copy_to_user(arg, ctrl, sizeof(*ctrl))) return -EFAULT; - } - fd_install(fd, file); return 0; }
Rely on the fd exit path machinery. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> --- io_uring/zcrx.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)