]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ksmbd: set unique value to volume serial field in FS_VOLUME_INFORMATION
authorNamjae Jeon <linkinjeon@kernel.org>
Sun, 31 Oct 2021 00:53:50 +0000 (09:53 +0900)
committerSteve French <stfrench@microsoft.com>
Fri, 12 Nov 2021 01:22:28 +0000 (19:22 -0600)
Steve French reported ksmbd set fixed value to volume serial field in
FS_VOLUME_INFORMATION. Volume serial value needs to be set to a unique
value for client fscache. This patch set crc value that is generated
with share name, path name and netbios name to volume serial.

Fixes: c4a98f110ba0 ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org # v5.15
Reported-by: Steve French <smfrench@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/Kconfig
fs/ksmbd/server.c
fs/ksmbd/smb2pdu.c

index b83cbd756ae50d44823c9fc9039c034faaeeb204..6af339cfdc0419db4ddababf8fd4d2a07bdc8fea 100644 (file)
@@ -19,6 +19,7 @@ config SMB_SERVER
        select CRYPTO_GCM
        select ASN1
        select OID_REGISTRY
+       select CRC32
        default n
        help
          Choose Y here if you want to allow SMB3 compliant clients
index 2a2b2135bfdede572220ab0a84d16e9427989863..36d368e59a6406e0211e7574008e0bb5d3fb913a 100644 (file)
@@ -632,5 +632,6 @@ MODULE_SOFTDEP("pre: sha512");
 MODULE_SOFTDEP("pre: aead2");
 MODULE_SOFTDEP("pre: ccm");
 MODULE_SOFTDEP("pre: gcm");
+MODULE_SOFTDEP("pre: crc32");
 module_init(ksmbd_server_init)
 module_exit(ksmbd_server_exit)
index a925e0f67fb8fee3adae74523bc2bb7bc250ae16..04f82b5870c33251c6220fe1f34f9b1715df7a8f 100644 (file)
@@ -4892,11 +4892,18 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
        {
                struct filesystem_vol_info *info;
                size_t sz;
+               unsigned int serial_crc = 0;
 
                info = (struct filesystem_vol_info *)(rsp->Buffer);
                info->VolumeCreationTime = 0;
+               serial_crc = crc32_le(serial_crc, share->name,
+                                     strlen(share->name));
+               serial_crc = crc32_le(serial_crc, share->path,
+                                     strlen(share->path));
+               serial_crc = crc32_le(serial_crc, ksmbd_netbios_name(),
+                                     strlen(ksmbd_netbios_name()));
                /* Taking dummy value of serial number*/
-               info->SerialNumber = cpu_to_le32(0xbc3ac512);
+               info->SerialNumber = cpu_to_le32(serial_crc);
                len = smbConvertToUTF16((__le16 *)info->VolumeLabel,
                                        share->name, PATH_MAX,
                                        conn->local_nls, 0);