]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: fix error code overwriting in smb2_get_info_filesystem()
authorMatvey Kovalev <matvey.kovalev@ispras.ru>
Thu, 25 Sep 2025 12:12:34 +0000 (15:12 +0300)
committerSteve French <stfrench@microsoft.com>
Wed, 1 Oct 2025 02:37:54 +0000 (21:37 -0500)
If client doesn't negotiate with SMB3.1.1 POSIX Extensions,
then proper error code won't be returned due to overwriting.

Return error immediately.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: e2f34481b24db ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Matvey Kovalev <matvey.kovalev@ispras.ru>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c

index 0c069eff80b771bc2c362180a2e9b352c314119d..133ca5beb7cf5b801a1435b15c765f6b106a26de 100644 (file)
@@ -5629,7 +5629,8 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 
                if (!work->tcon->posix_extensions) {
                        pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n");
-                       rc = -EOPNOTSUPP;
+                       path_put(&path);
+                       return -EOPNOTSUPP;
                } else {
                        info = (struct filesystem_posix_info *)(rsp->Buffer);
                        info->OptimalTransferSize = cpu_to_le32(stfs.f_bsize);