From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA22B345CDA; Thu, 16 Jul 2026 13:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784209600; cv=none; b=OtzN2Jo7JnW9ELzzTWYgFDW3LDTrT0UvK39wTc2pwshbzc3NrqiygxmF97u8Uo3jeZAaFrtQmXaoJcRLJp2ugPCbBnWR7orMAsVZTY0mGrUxd7BLKxCQpAa4orMJMCKIotYV2a4wc7kMA8R+85laAx9+O+FCZq2ZJtjvv3hnFIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784209600; c=relaxed/simple; bh=8vS4KqH/RPMI6swntem524A+HZPcwnvDCzQekHXeAcc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HTuwqhXhxlKa5MGbh7xyg6bnC3hPnaH2ByUIAARxU04PH4RbVQ5udu4tH+OqeYCuDdGJxQEC0chUFiHe9LUA7V7l+0spx2TcssZxgffCrLjQCAY48Q5Vs0uMotg4OZU6nLchHsYg/BddTQ/kIn/Ei3nb1I8VKOx//XVMYE3tYr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y7e9xplB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Y7e9xplB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 717AA1F000E9; Thu, 16 Jul 2026 13:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784209591; bh=SM4Rs7JstpszdvTy2ipeYlXwGvdpvlVwX2NUhS5YmKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y7e9xplB1dER+9mlJGES01pM5JL4/dOII5vr8c3/VUWEunWe2SV3GQoKQ1P84lkdK /If3oDxfjxCYvdxWDFMRfv5b8Gq/ymfSL9hgwZkeQZDy8DvrvaUOSktLyQ6PD3uxb3 9USOsaDRqZh9XoXKPabHSJzHUSZZ0aEA8bv5RxlU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Steve French , ChenXiaoSong , Namjae Jeon Subject: [PATCH 7.1 243/518] smb/server: do not require delete access for non-replacing links Date: Thu, 16 Jul 2026 15:28:31 +0200 Message-ID: <20260716133053.135519179@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133047.772246337@linuxfoundation.org> References: <20260716133047.772246337@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: ChenXiaoSong commit 851ed9e09639e0daf79a506ce26097b296ed5518 upstream. Reproducer: 1. server: systemctl start ksmbd 2. client: mount -t cifs //${server_ip}/export /mnt 3. client: touch /mnt/file; ln /mnt/file /mnt/hardlink 4. client err log: ln: failed to create hard link 'hardlink' => 'file': Permission denied 5. server err log: ksmbd: no right to delete : 0x80 Fixes: 13f3942f2bf4 ("ksmbd: add per-handle permission check to FILE_LINK_INFORMATION") Cc: stable@vger.kernel.org Reported-by: Steve French Signed-off-by: ChenXiaoSong Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/smb2pdu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -6564,16 +6564,18 @@ static int smb2_set_info_file(struct ksm } case FILE_LINK_INFORMATION: { - if (!(fp->daccess & FILE_DELETE_LE)) { - pr_err("no right to delete : 0x%x\n", fp->daccess); - return -EACCES; - } + struct smb2_file_link_info *file_info; if (buf_len < sizeof(struct smb2_file_link_info)) return -EMSGSIZE; - return smb2_create_link(work, work->tcon->share_conf, - (struct smb2_file_link_info *)buffer, + file_info = (struct smb2_file_link_info *)buffer; + if (file_info->ReplaceIfExists && !(fp->daccess & FILE_DELETE_LE)) { + pr_err("no right to delete : 0x%x\n", fp->daccess); + return -EACCES; + } + + return smb2_create_link(work, work->tcon->share_conf, file_info, buf_len, fp->filp, work->conn->local_nls); }