Skip to content

Commit 5d2f0b1

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: set unique value to volume serial field in FS_VOLUME_INFORMATION
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: e2f3448 ("cifsd: add server-side procedures for SMB3") Cc: [email protected] # v5.15 Reported-by: Steve French <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b53ad81 commit 5d2f0b1

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

fs/ksmbd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ config SMB_SERVER
1919
select CRYPTO_GCM
2020
select ASN1
2121
select OID_REGISTRY
22+
select CRC32
2223
default n
2324
help
2425
Choose Y here if you want to allow SMB3 compliant clients

fs/ksmbd/server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,5 +632,6 @@ MODULE_SOFTDEP("pre: sha512");
632632
MODULE_SOFTDEP("pre: aead2");
633633
MODULE_SOFTDEP("pre: ccm");
634634
MODULE_SOFTDEP("pre: gcm");
635+
MODULE_SOFTDEP("pre: crc32");
635636
module_init(ksmbd_server_init)
636637
module_exit(ksmbd_server_exit)

fs/ksmbd/smb2pdu.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4892,11 +4892,18 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
48924892
{
48934893
struct filesystem_vol_info *info;
48944894
size_t sz;
4895+
unsigned int serial_crc = 0;
48954896

48964897
info = (struct filesystem_vol_info *)(rsp->Buffer);
48974898
info->VolumeCreationTime = 0;
4899+
serial_crc = crc32_le(serial_crc, share->name,
4900+
strlen(share->name));
4901+
serial_crc = crc32_le(serial_crc, share->path,
4902+
strlen(share->path));
4903+
serial_crc = crc32_le(serial_crc, ksmbd_netbios_name(),
4904+
strlen(ksmbd_netbios_name()));
48984905
/* Taking dummy value of serial number*/
4899-
info->SerialNumber = cpu_to_le32(0xbc3ac512);
4906+
info->SerialNumber = cpu_to_le32(serial_crc);
49004907
len = smbConvertToUTF16((__le16 *)info->VolumeLabel,
49014908
share->name, PATH_MAX,
49024909
conn->local_nls, 0);

0 commit comments

Comments
 (0)