]> git.hungrycats.org Git - linux/commit
io_uring/zcrx: reorder fd allocation in zcrx_export()
authorBertie Tryner <bertietryner@gmail.com>
Tue, 19 May 2026 11:44:30 +0000 (12:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 May 2026 16:42:01 +0000 (10:42 -0600)
commit84f7d0931c42cb0690615a431738cf6913d265f2
treea9784759fcc7cc2569723502537ff0eecff41ff3
parent98f07b0f74b65284ebe0d021505b461d4be6bf07
io_uring/zcrx: reorder fd allocation in zcrx_export()

Currently, zcrx_export() allocates a file descriptor and copies the
control structure to userspace before the backing file is created.

While the operation returns an error on failure, it is cleaner to
follow the standard kernel pattern of performing the copy_to_user()
and fd_install() only after all resource allocations (like the
anon_inode) have succeeded. This aligns the code with other
fd-publishing paths in the VFS.

Signed-off-by: Bertie Tryner <Bertie.Tryner@warwick.ac.uk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/1513a3f4ae7161692ca6e991b9f01278a6bc60e4.1779189667.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/zcrx.c