Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2129887rdb; Mon, 20 Nov 2023 02:57:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8wxvnGxjgii3yfjaDCEZFIwDBej+3/wUl8aEOcALC8iMjnYghAg00DoimRrK4+863YHYz X-Received: by 2002:a17:90b:4c0d:b0:285:3510:150c with SMTP id na13-20020a17090b4c0d00b002853510150cmr248019pjb.33.1700477831399; Mon, 20 Nov 2023 02:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477831; cv=none; d=google.com; s=arc-20160816; b=Q/NF4HvYsdTSe8spgqIIsbs/KBRkyLE4xNseQ++p+zR/OH+g0J27sSwgoVSAK1qIaP oyCj8m0ILSO3ocJCX18V6aH0WB3tzSaqZ37whVGKTCe9L0V5QWTmVjMi3cvvfnKfEVbp QrYBGM+tfNCl2+/HmaABBR16x82vvp9Zs8xb7xggpj3y5S3jWep3OqJ81vYfm4diHs0f W1lChRNGfvIZVfR5FD7xgKJrGXGoqcMmyOIcDpUGmhbCKJ6+bNmK7KGeQFMagNiiMSEV Qu2hnOCyCdIkyUqBXRtl3hGG16VOE9bkCE49kMu54hZnys5EoZHqjbuaGiyvjn6SkFK7 NK3g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=58d2U9xwG/dFDTm6m8iS0jLQCEukimChxPfpR9Nt88k=; fh=760X2yt44SBWZtkUHWFELc/hToQRdxHbhqAPyV8vcRs=; b=ANYbFj0igkHjWhE9s974U+qdihBZYqWNomgIhTABiaQWHB3M31Z1AJ0uSMU5x+laQZ 9N76bMjBW/gr5k+MKdHzw5RwrkXBWh8oDVUT8RrSEYM6pFI0Z13xsCigo3tfySXdDVFS LSani253J4TIAwoL7WQbxfuMK038uWDcKM+A8/VXVN5cu4vkSEbN22IVult2TJyxkfs9 ahAQNIrkiUX4dmcX/XYDJCaIGgGHfabg4hPzK0GO2Rfj8xD9/i0MxB05OEVqner6q+o4 w4a3il8C08z8IBEXpiii3wuOsqSeiiwXk8egkTSvZN9qTEDK+zww8Mc/LO7hxg2pZ7ou QlqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=US7XIkJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x7-20020a17090a530700b00277517b42dasi7697283pjh.35.2023.11.20.02.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=US7XIkJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8B099805A799; Mon, 20 Nov 2023 02:56:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233147AbjKTK4O (ORCPT + 99 others); Mon, 20 Nov 2023 05:56:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233175AbjKTK4J (ORCPT ); Mon, 20 Nov 2023 05:56:09 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EBBA129 for ; Mon, 20 Nov 2023 02:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700477764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=58d2U9xwG/dFDTm6m8iS0jLQCEukimChxPfpR9Nt88k=; b=US7XIkJLTkayhuASJab74R9VZ5ik6LxEJszbgSnEbjn7UYFbg7MGh1b9f1TEU1ZCf2DHAt 3+Nubkvhq6AUQ8Nk/kVBge4tJ/MSzPWyVjmkP/j4g49cX4BUI6DSBGDjxoSckRJqTZyrtk lXY/GBVBjCzxKay/GEF+7rcTd8GD53Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-656-1JNkX8rcO2iydwKGkdNdiQ-1; Mon, 20 Nov 2023 05:55:58 -0500 X-MC-Unique: 1JNkX8rcO2iydwKGkdNdiQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78EC38007B3; Mon, 20 Nov 2023 10:55:58 +0000 (UTC) Received: from cmirabil.redhat.com (unknown [10.22.8.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E4F65036; Mon, 20 Nov 2023 10:55:58 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: axboe@kernel.dk, asml.silence@gmail.com, io-uring@vger.kernel.org, Charles Mirabile , stable@vger.kernel.org Subject: [PATCH] io_uring/fs: consider link->flags when getting path for LINKAT Date: Mon, 20 Nov 2023 05:55:45 -0500 Message-ID: <20231120105545.1209530-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:56:55 -0800 (PST) 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: stable@vger.kernel.org Link: https://github.com/axboe/liburing/issues/995 Signed-off-by: Charles Mirabile --- io_uring/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/fs.c b/io_uring/fs.c index 08e3b175469c..eccea851dd5a 100644 --- a/io_uring/fs.c +++ b/io_uring/fs.c @@ -254,7 +254,7 @@ int io_linkat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 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); -- 2.41.0