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 8F8C848C3EA for ; Tue, 14 Jul 2026 14:50:25 +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=1784040629; cv=none; b=JhQfaXte8ctE6YQGEMLye/oSHYJpwESLVbawIuS2ewR4NSFptQTHxbmXtpA+iLEAcbK2KQquzsdbMyGDo6jkVGxDN5XI9FD/1EVkeb1IbuAkoX1T8MPcG2Qo0S3od97z2f0hNRdXEMnUyGc9UdxrkY4HOaC3RHY0kxSpcGs56i8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784040629; c=relaxed/simple; bh=9mGZB5gm9zpp1DZUBQSk/mUJtq9jh/DhiIuO00d41BU=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=V/LiTPuE53PoUsA2Qx1dUTbN/GFdaIt9eFvK2dkL/0fAK2f3YfT9/DXjUa727dU+f+aMTSJ7b5c45bo0iroFN+g9sdnRBqmUXoJeR6h7WzdUfjOhVMmLbKkfPXWKkQUIxC1FHDrUoNMG25cRaF7PuSKYQFka1xoncKIYCps/CZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=g5WnUpF3; 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="g5WnUpF3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD2571F00A3D; Tue, 14 Jul 2026 14:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784040625; bh=A2+fBLIMKngwgEUuefoN4SiN7joNqD5gpDik7nBhStE=; h=Subject:To:Cc:From:Date; b=g5WnUpF3shX25WrFosUW2bv5O1vbJoUa0BM+1B75hjYAAWaKUUNlvoIwmTDTXn3f2 ytkmEx/efb5QzjoVSBLd9yjuWwaXUdkV9v2zvg0O7KOFiZRbfto32PZW4jQE/FeHjm e4SQY2kgg9KxZTqXH4YfLiKE0oGRveLbVEyoBORQ= Subject: FAILED: patch "[PATCH] smb/server: do not require delete access for non-replacing" failed to apply to 6.1-stable tree To: chenxiaosong@kylinos.cn,linkinjeon@kernel.org,stfrench@microsoft.com Cc: From: Date: Tue, 14 Jul 2026 16:47:09 +0200 Message-ID: <2026071409-clamp-reminder-aacc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 851ed9e09639e0daf79a506ce26097b296ed5518 # git commit -s git send-email --to '' --in-reply-to '2026071409-clamp-reminder-aacc@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 851ed9e09639e0daf79a506ce26097b296ed5518 Mon Sep 17 00:00:00 2001 From: ChenXiaoSong Date: Sun, 28 Jun 2026 07:42:43 +0000 Subject: [PATCH] smb/server: do not require delete access for non-replacing links 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 diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 727ba86ede36..097f51fc7ed6 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -6921,16 +6921,18 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp, } 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); }