Commit 7837d000 authored by Steve French's avatar Steve French Committed by Luis Henriques

SMB3: GUIDs should be constructed as random but valid uuids

BugLink: http://bugs.launchpad.net/bugs/1637510

commit fa70b87c upstream.

GUIDs although random, and 16 bytes, need to be generated as
proper uuids.
Signed-off-by: default avatarSteve French <steve.french@primarydata.com>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Reported-by: default avatarDavid Goebels <davidgoe@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent c610a52d
...@@ -268,7 +268,7 @@ cifs_alloc_inode(struct super_block *sb) ...@@ -268,7 +268,7 @@ cifs_alloc_inode(struct super_block *sb)
cifs_inode->createtime = 0; cifs_inode->createtime = 0;
cifs_inode->epoch = 0; cifs_inode->epoch = 0;
#ifdef CONFIG_CIFS_SMB2 #ifdef CONFIG_CIFS_SMB2
get_random_bytes(cifs_inode->lease_key, SMB2_LEASE_KEY_SIZE); generate_random_uuid(cifs_inode->lease_key);
#endif #endif
/* /*
* Can not set i_flags here - they get immediately overwritten to zero * Can not set i_flags here - they get immediately overwritten to zero
......
...@@ -2200,7 +2200,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) ...@@ -2200,7 +2200,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr, memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr,
sizeof(tcp_ses->dstaddr)); sizeof(tcp_ses->dstaddr));
#ifdef CONFIG_CIFS_SMB2 #ifdef CONFIG_CIFS_SMB2
get_random_bytes(tcp_ses->client_guid, SMB2_CLIENT_GUID_SIZE); generate_random_uuid(tcp_ses->client_guid);
#endif #endif
/* /*
* at this point we are the only ones with the pointer * at this point we are the only ones with the pointer
......
...@@ -1037,7 +1037,7 @@ smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid) ...@@ -1037,7 +1037,7 @@ smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid)
static void static void
smb2_new_lease_key(struct cifs_fid *fid) smb2_new_lease_key(struct cifs_fid *fid)
{ {
get_random_bytes(fid->lease_key, SMB2_LEASE_KEY_SIZE); generate_random_uuid(fid->lease_key);
} }
#define SMB2_SYMLINK_STRUCT_SIZE \ #define SMB2_SYMLINK_STRUCT_SIZE \
......
...@@ -1186,7 +1186,7 @@ create_durable_v2_buf(struct cifs_fid *pfid) ...@@ -1186,7 +1186,7 @@ create_durable_v2_buf(struct cifs_fid *pfid)
buf->dcontext.Timeout = 0; /* Should this be configurable by workload */ buf->dcontext.Timeout = 0; /* Should this be configurable by workload */
buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT); buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT);
get_random_bytes(buf->dcontext.CreateGuid, 16); generate_random_uuid(buf->dcontext.CreateGuid);
memcpy(pfid->create_guid, buf->dcontext.CreateGuid, 16); memcpy(pfid->create_guid, buf->dcontext.CreateGuid, 16);
/* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DH2Q" */ /* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DH2Q" */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment