diff options
author | Steve French <smfrench@gmail.com> | 2016-09-22 01:39:34 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2016-10-12 13:08:32 -0400 |
commit | fa70b87cc6641978b20e12cc5d517e9ffc0086d4 (patch) | |
tree | c5ef0b1540ee5c4ed891ff2ecc0d95aa216039f7 | |
parent | c2afb8147e69819885493edf3a7c1ce03aaf2d4e (diff) |
SMB3: GUIDs should be constructed as random but valid uuids
GUIDs although random, and 16 bytes, need to be generated as
proper uuids.
Signed-off-by: Steve French <steve.french@primarydata.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Reported-by: David Goebels <davidgoe@microsoft.com>
CC: Stable <stable@vger.kernel.org>
-rw-r--r-- | fs/cifs/cifsfs.c | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb2ops.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index cca04e710421..978dbf049a77 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -271,7 +271,7 @@ cifs_alloc_inode(struct super_block *sb) | |||
271 | cifs_inode->createtime = 0; | 271 | cifs_inode->createtime = 0; |
272 | cifs_inode->epoch = 0; | 272 | cifs_inode->epoch = 0; |
273 | #ifdef CONFIG_CIFS_SMB2 | 273 | #ifdef CONFIG_CIFS_SMB2 |
274 | get_random_bytes(cifs_inode->lease_key, SMB2_LEASE_KEY_SIZE); | 274 | generate_random_uuid(cifs_inode->lease_key); |
275 | #endif | 275 | #endif |
276 | /* | 276 | /* |
277 | * Can not set i_flags here - they get immediately overwritten to zero | 277 | * Can not set i_flags here - they get immediately overwritten to zero |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2e4f4bad8b1e..c841244a954d 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2163,7 +2163,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
2163 | memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr, | 2163 | memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr, |
2164 | sizeof(tcp_ses->dstaddr)); | 2164 | sizeof(tcp_ses->dstaddr)); |
2165 | #ifdef CONFIG_CIFS_SMB2 | 2165 | #ifdef CONFIG_CIFS_SMB2 |
2166 | get_random_bytes(tcp_ses->client_guid, SMB2_CLIENT_GUID_SIZE); | 2166 | generate_random_uuid(tcp_ses->client_guid); |
2167 | #endif | 2167 | #endif |
2168 | /* | 2168 | /* |
2169 | * at this point we are the only ones with the pointer | 2169 | * at this point we are the only ones with the pointer |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index d203c0329626..5ed591d7fff3 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -1041,7 +1041,7 @@ smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid) | |||
1041 | static void | 1041 | static void |
1042 | smb2_new_lease_key(struct cifs_fid *fid) | 1042 | smb2_new_lease_key(struct cifs_fid *fid) |
1043 | { | 1043 | { |
1044 | get_random_bytes(fid->lease_key, SMB2_LEASE_KEY_SIZE); | 1044 | generate_random_uuid(fid->lease_key); |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | #define SMB2_SYMLINK_STRUCT_SIZE \ | 1047 | #define SMB2_SYMLINK_STRUCT_SIZE \ |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e8638432a233..3eec96ca87d9 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -1183,7 +1183,7 @@ create_durable_v2_buf(struct cifs_fid *pfid) | |||
1183 | 1183 | ||
1184 | buf->dcontext.Timeout = 0; /* Should this be configurable by workload */ | 1184 | buf->dcontext.Timeout = 0; /* Should this be configurable by workload */ |
1185 | buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT); | 1185 | buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT); |
1186 | get_random_bytes(buf->dcontext.CreateGuid, 16); | 1186 | generate_random_uuid(buf->dcontext.CreateGuid); |
1187 | memcpy(pfid->create_guid, buf->dcontext.CreateGuid, 16); | 1187 | memcpy(pfid->create_guid, buf->dcontext.CreateGuid, 16); |
1188 | 1188 | ||
1189 | /* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DH2Q" */ | 1189 | /* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DH2Q" */ |