From: Charles Mirabile Date: Mon, 20 Nov 2023 10:55:45 +0000 (-0500) Subject: io_uring/fs: consider link->flags when getting path for LINKAT X-Git-Tag: v5.15.141~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35b5d86e43ec8efe2e40881a1f0b49da72efe9e4;p=thirdparty%2Fkernel%2Fstable.git io_uring/fs: consider link->flags when getting path for LINKAT commit 8479063f1fbee201a8739130e816cc331b675838 upstream. In order for `AT_EMPTY_PATH` to work as expected, the fact that the user wants that behavior needs to make it to `getname_flags` or it will return ENOENT. Fixes: cf30da90bc3a ("io_uring: add support for IORING_OP_LINKAT") Cc: Link: https://github.com/axboe/liburing/issues/995 Signed-off-by: Charles Mirabile Link: https://lore.kernel.org/r/20231120105545.1209530-1-cmirabil@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index e26292d8b8457..4852e8579df5d 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -4049,7 +4049,7 @@ static int io_linkat_prep(struct io_kiocb *req, newf = u64_to_user_ptr(READ_ONCE(sqe->addr2)); lnk->flags = READ_ONCE(sqe->hardlink_flags); - lnk->oldpath = getname(oldf); + lnk->oldpath = getname_uflags(oldf, lnk->flags); if (IS_ERR(lnk->oldpath)) return PTR_ERR(lnk->oldpath);