Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'v6.12-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

- statfs fix (e.g. when limited access to root directory of share)

- special file handling fixes: fix packet validation to avoid buffer
overflow for reparse points, fixes for symlink path parsing (one for
reparse points, and one for SFU use case), and fix for cleanup after
failed SET_REPARSE operation.

- fix for SMB2.1 signing bug introduced by recent patch to NFS symlink
path, and NFS reparse point validation

- comment cleanup

* tag 'v6.12-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: Do not convert delimiter when parsing NFS-style symlinks
cifs: Validate content of NFS reparse point buffer
cifs: Fix buffer overflow when parsing NFS reparse points
smb: client: Correct typos in multiple comments across various files
smb: client: use actual path when queryfs
cifs: Remove intermediate object of failed create reparse call
Revert "smb: client: make SHA-512 TFM ephemeral"
smb: Update comments about some reparse point tags
cifs: Check for UTF-16 null codepoint in SFU symlink target location

+169 -61
+1 -1
fs/smb/client/cifsacl.h
··· 55 55 #define ACL_CONTROL_SI 0x0800 /* SACL Auto-Inherited */ 56 56 #define ACL_CONTROL_DI 0x0400 /* DACL Auto-Inherited */ 57 57 #define ACL_CONTROL_SC 0x0200 /* SACL computed through inheritance */ 58 - #define ACL_CONTROL_DC 0x0100 /* DACL computed through inheritence */ 58 + #define ACL_CONTROL_DC 0x0100 /* DACL computed through inheritance */ 59 59 #define ACL_CONTROL_SS 0x0080 /* Create server ACL */ 60 60 #define ACL_CONTROL_DT 0x0040 /* DACL provided by trusted source */ 61 61 #define ACL_CONTROL_SD 0x0020 /* SACL defaulted */
+2 -1
fs/smb/client/cifsencrypt.c
··· 239 239 cifs_dbg(FYI, "dummy signature received for smb command 0x%x\n", 240 240 cifs_pdu->Command); 241 241 242 - /* save off the origiginal signature so we can modify the smb and check 242 + /* save off the original signature so we can modify the smb and check 243 243 its signature against what the server sent */ 244 244 memcpy(server_response_sig, cifs_pdu->Signature.SecuritySignature, 8); 245 245 ··· 700 700 cifs_free_hash(&server->secmech.aes_cmac); 701 701 cifs_free_hash(&server->secmech.hmacsha256); 702 702 cifs_free_hash(&server->secmech.md5); 703 + cifs_free_hash(&server->secmech.sha512); 703 704 704 705 if (!SERVER_IS_CHAN(server)) { 705 706 if (server->secmech.enc) {
+14 -3
fs/smb/client/cifsfs.c
··· 161 161 162 162 /* 163 163 * Bumps refcount for cifs super block. 164 - * Note that it should be only called if a referece to VFS super block is 164 + * Note that it should be only called if a reference to VFS super block is 165 165 * already held, e.g. in open-type syscalls context. Otherwise it can race with 166 166 * atomic_dec_and_test in deactivate_locked_super. 167 167 */ ··· 289 289 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 290 290 291 291 /* 292 - * We ned to release all dentries for the cached directories 292 + * We need to release all dentries for the cached directories 293 293 * before we kill the sb. 294 294 */ 295 295 if (cifs_sb->root) { ··· 313 313 struct TCP_Server_Info *server = tcon->ses->server; 314 314 unsigned int xid; 315 315 int rc = 0; 316 + const char *full_path; 317 + void *page; 316 318 317 319 xid = get_xid(); 320 + page = alloc_dentry_path(); 321 + 322 + full_path = build_path_from_dentry(dentry, page); 323 + if (IS_ERR(full_path)) { 324 + rc = PTR_ERR(full_path); 325 + goto statfs_out; 326 + } 318 327 319 328 if (le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength) > 0) 320 329 buf->f_namelen = ··· 339 330 buf->f_ffree = 0; /* unlimited */ 340 331 341 332 if (server->ops->queryfs) 342 - rc = server->ops->queryfs(xid, tcon, cifs_sb, buf); 333 + rc = server->ops->queryfs(xid, tcon, full_path, cifs_sb, buf); 343 334 335 + statfs_out: 336 + free_dentry_path(page); 344 337 free_xid(xid); 345 338 return rc; 346 339 }
+3 -2
fs/smb/client/cifsglob.h
··· 180 180 struct cifs_secmech { 181 181 struct shash_desc *md5; /* md5 hash function, for CIFS/SMB1 signatures */ 182 182 struct shash_desc *hmacsha256; /* hmac-sha256 hash function, for SMB2 signatures */ 183 + struct shash_desc *sha512; /* sha512 hash function, for SMB3.1.1 preauth hash */ 183 184 struct shash_desc *aes_cmac; /* block-cipher based MAC function, for SMB3 signatures */ 184 185 185 186 struct crypto_aead *enc; /* smb3 encryption AEAD TFM (AES-CCM and AES-GCM) */ ··· 481 480 __u16 net_fid, struct cifsInodeInfo *cifs_inode); 482 481 /* query remote filesystem */ 483 482 int (*queryfs)(const unsigned int, struct cifs_tcon *, 484 - struct cifs_sb_info *, struct kstatfs *); 483 + const char *, struct cifs_sb_info *, struct kstatfs *); 485 484 /* send mandatory brlock to the server */ 486 485 int (*mand_lock)(const unsigned int, struct cifsFileInfo *, __u64, 487 486 __u64, __u32, int, int, bool); ··· 775 774 } compression; 776 775 __u16 signing_algorithm; 777 776 __le16 cipher_type; 778 - /* save initital negprot hash */ 777 + /* save initial negprot hash */ 779 778 __u8 preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE]; 780 779 bool signing_negotiated; /* true if valid signing context rcvd from server */ 781 780 bool posix_ext_supported;
+2 -2
fs/smb/client/cifspdu.h
··· 781 781 __u16 ByteCount; 782 782 } __attribute__((packed)) LOGOFF_ANDX_RSP; 783 783 784 - typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on 784 + typedef union smb_com_tree_disconnect { /* as an alternative can use flag on 785 785 tree_connect PDU to effect disconnect */ 786 786 /* tdis is probably simplest SMB PDU */ 787 787 struct { ··· 2406 2406 __le64 cifs_uid; /* or gid */ 2407 2407 } __attribute__((packed)); 2408 2408 2409 - struct cifs_posix_acl { /* access conrol list (ACL) */ 2409 + struct cifs_posix_acl { /* access control list (ACL) */ 2410 2410 __le16 version; 2411 2411 __le16 access_entry_count; /* access ACL - count of entries */ 2412 2412 __le16 default_entry_count; /* default ACL - count of entries */
+3 -3
fs/smb/client/cifssmb.c
··· 1215 1215 req->CreateDisposition = cpu_to_le32(disposition); 1216 1216 req->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); 1217 1217 1218 - /* BB Expirement with various impersonation levels and verify */ 1218 + /* BB Experiment with various impersonation levels and verify */ 1219 1219 req->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); 1220 1220 req->SecurityFlags = SECURITY_CONTEXT_TRACKING|SECURITY_EFFECTIVE_ONLY; 1221 1221 ··· 3018 3018 3019 3019 /** 3020 3020 * posix_acl_to_cifs - convert ACLs from POSIX ACL to cifs format 3021 - * @parm_data: ACLs in cifs format to conver to 3021 + * @parm_data: ACLs in cifs format to convert to 3022 3022 * @acl: ACLs in POSIX ACL format to convert from 3023 3023 * @acl_type: the type of POSIX ACLs stored in @acl 3024 3024 * ··· 3995 3995 name_len = 3996 3996 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName, 3997 3997 PATH_MAX, nls_codepage, remap); 3998 - /* We can not add the asterik earlier in case 3998 + /* We can not add the asterisk earlier in case 3999 3999 it got remapped to 0xF03A as if it were part of the 4000 4000 directory name instead of a wildcard */ 4001 4001 name_len *= 2;
+1 -1
fs/smb/client/file.c
··· 2502 2502 } 2503 2503 } 2504 2504 } 2505 - /* couldn't find useable FH with same pid, try any available */ 2505 + /* couldn't find usable FH with same pid, try any available */ 2506 2506 if (!any_available) { 2507 2507 any_available = true; 2508 2508 goto refind_writable;
+1 -1
fs/smb/client/fs_context.h
··· 260 260 unsigned int min_offload; 261 261 unsigned int retrans; 262 262 bool sockopt_tcp_nodelay:1; 263 - /* attribute cache timemout for files and directories in jiffies */ 263 + /* attribute cache timeout for files and directories in jiffies */ 264 264 unsigned long acregmax; 265 265 unsigned long acdirmax; 266 266 /* timeout for deferred close of files in jiffies */
+7 -1
fs/smb/client/inode.c
··· 629 629 &symlink_len_utf16, 630 630 &symlink_buf_utf16, 631 631 &buf_type); 632 + /* 633 + * Check that read buffer has valid length and does not 634 + * contain UTF-16 null codepoint (via UniStrnlen() call) 635 + * because Linux cannot process symlink with null byte. 636 + */ 632 637 if ((rc == 0) && 633 638 (symlink_len_utf16 > 0) && 634 639 (symlink_len_utf16 < fattr->cf_eof-8 + 1) && 635 - (symlink_len_utf16 % 2 == 0)) { 640 + (symlink_len_utf16 % 2 == 0) && 641 + (UniStrnlen((wchar_t *)symlink_buf_utf16, symlink_len_utf16/2) == symlink_len_utf16/2)) { 636 642 fattr->cf_symlink_target = 637 643 cifs_strndup_from_utf16(symlink_buf_utf16, 638 644 symlink_len_utf16,
+1 -1
fs/smb/client/misc.c
··· 254 254 } 255 255 256 256 /* NB: MID can not be set if treeCon not passed in, in that 257 - case it is responsbility of caller to set the mid */ 257 + case it is responsibility of caller to set the mid */ 258 258 void 259 259 header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , 260 260 const struct cifs_tcon *treeCon, int word_count
+1 -1
fs/smb/client/netmisc.c
··· 1003 1003 year is 2**7, the last year is 1980+127, which means we need only 1004 1004 consider 2 special case years, ie the years 2000 and 2100, and only 1005 1005 adjust for the lack of leap year for the year 2100, as 2000 was a 1006 - leap year (divisable by 400) */ 1006 + leap year (divisible by 400) */ 1007 1007 if (year >= 120) /* the year 2100 */ 1008 1008 days = days - 1; /* do not count leap year for the year 2100 */ 1009 1009
+2 -2
fs/smb/client/readdir.c
··· 553 553 const FIND_FILE_STANDARD_INFO *info) 554 554 { 555 555 de->name = &info->FileName[0]; 556 - /* one byte length, no endianess conversion */ 556 + /* one byte length, no endianness conversion */ 557 557 de->namelen = info->FileNameLength; 558 558 de->resume_key = info->ResumeKey; 559 559 } ··· 815 815 * However, this sequence of ->pos values may have holes 816 816 * in it, for example dot-dirs returned from the server 817 817 * are suppressed. 818 - * Handle this bu forcing ctx->pos to be the same as the 818 + * Handle this by forcing ctx->pos to be the same as the 819 819 * ->pos of the current dirent we emit from the cache. 820 820 * This means that when we emit these entries from the cache 821 821 * we now emit them with the same ->pos value as in the
+37 -2
fs/smb/client/reparse.c
··· 320 320 unsigned int len; 321 321 u64 type; 322 322 323 + len = le16_to_cpu(buf->ReparseDataLength); 324 + if (len < sizeof(buf->InodeType)) { 325 + cifs_dbg(VFS, "srv returned malformed nfs buffer\n"); 326 + return -EIO; 327 + } 328 + 329 + len -= sizeof(buf->InodeType); 330 + 323 331 switch ((type = le64_to_cpu(buf->InodeType))) { 324 332 case NFS_SPECFILE_LNK: 325 - len = le16_to_cpu(buf->ReparseDataLength); 333 + if (len == 0 || (len % 2)) { 334 + cifs_dbg(VFS, "srv returned malformed nfs symlink buffer\n"); 335 + return -EIO; 336 + } 337 + /* 338 + * Check that buffer does not contain UTF-16 null codepoint 339 + * because Linux cannot process symlink with null byte. 340 + */ 341 + if (UniStrnlen((wchar_t *)buf->DataBuffer, len/2) != len/2) { 342 + cifs_dbg(VFS, "srv returned null byte in nfs symlink target location\n"); 343 + return -EIO; 344 + } 326 345 data->symlink_target = cifs_strndup_from_utf16(buf->DataBuffer, 327 346 len, true, 328 347 cifs_sb->local_nls); 329 348 if (!data->symlink_target) 330 349 return -ENOMEM; 331 - convert_delimiter(data->symlink_target, '/'); 332 350 cifs_dbg(FYI, "%s: target path: %s\n", 333 351 __func__, data->symlink_target); 334 352 break; 335 353 case NFS_SPECFILE_CHR: 336 354 case NFS_SPECFILE_BLK: 355 + /* DataBuffer for block and char devices contains two 32-bit numbers */ 356 + if (len != 8) { 357 + cifs_dbg(VFS, "srv returned malformed nfs buffer for type: 0x%llx\n", type); 358 + return -EIO; 359 + } 360 + break; 337 361 case NFS_SPECFILE_FIFO: 338 362 case NFS_SPECFILE_SOCK: 363 + /* DataBuffer for fifos and sockets is empty */ 364 + if (len != 0) { 365 + cifs_dbg(VFS, "srv returned malformed nfs buffer for type: 0x%llx\n", type); 366 + return -EIO; 367 + } 339 368 break; 340 369 default: 341 370 cifs_dbg(VFS, "%s: unhandled inode type: 0x%llx\n", ··· 511 482 u32 tag = data->reparse.tag; 512 483 513 484 if (tag == IO_REPARSE_TAG_NFS && buf) { 485 + if (le16_to_cpu(buf->ReparseDataLength) < sizeof(buf->InodeType)) 486 + return false; 514 487 switch (le64_to_cpu(buf->InodeType)) { 515 488 case NFS_SPECFILE_CHR: 489 + if (le16_to_cpu(buf->ReparseDataLength) != sizeof(buf->InodeType) + 8) 490 + return false; 516 491 fattr->cf_mode |= S_IFCHR; 517 492 fattr->cf_rdev = reparse_mkdev(buf->DataBuffer); 518 493 break; 519 494 case NFS_SPECFILE_BLK: 495 + if (le16_to_cpu(buf->ReparseDataLength) != sizeof(buf->InodeType) + 8) 496 + return false; 520 497 fattr->cf_mode |= S_IFBLK; 521 498 fattr->cf_rdev = reparse_mkdev(buf->DataBuffer); 522 499 break;
+1 -1
fs/smb/client/sess.c
··· 624 624 * to sign packets before we generate the channel signing key 625 625 * (we sign with the session key) 626 626 */ 627 - rc = smb3_crypto_shash_allocate(chan->server); 627 + rc = smb311_crypto_shash_allocate(chan->server); 628 628 if (rc) { 629 629 cifs_dbg(VFS, "%s: crypto alloc failed\n", __func__); 630 630 mutex_unlock(&ses->session_mutex);
+1 -1
fs/smb/client/smb1ops.c
··· 909 909 910 910 static int 911 911 cifs_queryfs(const unsigned int xid, struct cifs_tcon *tcon, 912 - struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 912 + const char *path, struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 913 913 { 914 914 int rc = -EOPNOTSUPP; 915 915
+22 -2
fs/smb/client/smb2inode.c
··· 1205 1205 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 1206 1206 struct cifsFileInfo *cfile; 1207 1207 struct inode *new = NULL; 1208 + int out_buftype[4] = {}; 1209 + struct kvec out_iov[4] = {}; 1208 1210 struct kvec in_iov[2]; 1209 1211 int cmds[2]; 1210 1212 int rc; 1213 + int i; 1211 1214 1212 1215 oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, 1213 1216 SYNCHRONIZE | DELETE | ··· 1231 1228 cmds[1] = SMB2_OP_POSIX_QUERY_INFO; 1232 1229 cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile); 1233 1230 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, &oparms, 1234 - in_iov, cmds, 2, cfile, NULL, NULL, NULL); 1231 + in_iov, cmds, 2, cfile, out_iov, out_buftype, NULL); 1235 1232 if (!rc) { 1236 1233 rc = smb311_posix_get_inode_info(&new, full_path, 1237 1234 data, sb, xid); ··· 1240 1237 cmds[1] = SMB2_OP_QUERY_INFO; 1241 1238 cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile); 1242 1239 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, &oparms, 1243 - in_iov, cmds, 2, cfile, NULL, NULL, NULL); 1240 + in_iov, cmds, 2, cfile, out_iov, out_buftype, NULL); 1244 1241 if (!rc) { 1245 1242 rc = cifs_get_inode_info(&new, full_path, 1246 1243 data, sb, xid, NULL); 1247 1244 } 1248 1245 } 1246 + 1247 + 1248 + /* 1249 + * If CREATE was successful but SMB2_OP_SET_REPARSE failed then 1250 + * remove the intermediate object created by CREATE. Otherwise 1251 + * empty object stay on the server when reparse call failed. 1252 + */ 1253 + if (rc && 1254 + out_iov[0].iov_base != NULL && out_buftype[0] != CIFS_NO_BUFFER && 1255 + ((struct smb2_hdr *)out_iov[0].iov_base)->Status == STATUS_SUCCESS && 1256 + (out_iov[1].iov_base == NULL || out_buftype[1] == CIFS_NO_BUFFER || 1257 + ((struct smb2_hdr *)out_iov[1].iov_base)->Status != STATUS_SUCCESS)) 1258 + smb2_unlink(xid, tcon, full_path, cifs_sb, NULL); 1259 + 1260 + for (i = 0; i < ARRAY_SIZE(out_buftype); i++) 1261 + free_rsp_buf(out_buftype[i], out_iov[i].iov_base); 1262 + 1249 1263 return rc ? ERR_PTR(rc) : new; 1250 1264 } 1251 1265
+16 -16
fs/smb/client/smb2misc.c
··· 906 906 || (hdr->Status != 907 907 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED)))) 908 908 return 0; 909 - ok: 910 - rc = cifs_alloc_hash("sha512", &sha512); 911 - if (rc) { 912 - cifs_dbg(VFS, "%s: Could not allocate SHA512 shash, rc=%d\n", __func__, rc); 913 - return rc; 914 - } 915 909 910 + ok: 911 + rc = smb311_crypto_shash_allocate(server); 912 + if (rc) 913 + return rc; 914 + 915 + sha512 = server->secmech.sha512; 916 916 rc = crypto_shash_init(sha512); 917 917 if (rc) { 918 - cifs_dbg(VFS, "%s: Could not init SHA512 shash, rc=%d\n", __func__, rc); 919 - goto err_free; 918 + cifs_dbg(VFS, "%s: Could not init sha512 shash\n", __func__); 919 + return rc; 920 920 } 921 921 922 922 rc = crypto_shash_update(sha512, ses->preauth_sha_hash, 923 923 SMB2_PREAUTH_HASH_SIZE); 924 924 if (rc) { 925 - cifs_dbg(VFS, "%s: Could not update SHA512 shash, rc=%d\n", __func__, rc); 926 - goto err_free; 925 + cifs_dbg(VFS, "%s: Could not update sha512 shash\n", __func__); 926 + return rc; 927 927 } 928 928 929 929 for (i = 0; i < nvec; i++) { 930 930 rc = crypto_shash_update(sha512, iov[i].iov_base, iov[i].iov_len); 931 931 if (rc) { 932 - cifs_dbg(VFS, "%s: Could not update SHA512 shash, rc=%d\n", __func__, rc); 933 - goto err_free; 932 + cifs_dbg(VFS, "%s: Could not update sha512 shash\n", 933 + __func__); 934 + return rc; 934 935 } 935 936 } 936 937 937 938 rc = crypto_shash_final(sha512, ses->preauth_sha_hash); 938 939 if (rc) { 939 - cifs_dbg(VFS, "%s: Could not finalize SHA12 shash, rc=%d\n", __func__, rc); 940 - goto err_free; 940 + cifs_dbg(VFS, "%s: Could not finalize sha512 shash\n", 941 + __func__); 942 + return rc; 941 943 } 942 - err_free: 943 - cifs_free_hash(&sha512); 944 944 945 945 return 0; 946 946 }
+14 -9
fs/smb/client/smb2ops.c
··· 2177 2177 NULL, 0 /* no input data */, max_response_size, 2178 2178 (char **)&retbuf, 2179 2179 &ret_data_len); 2180 - cifs_dbg(FYI, "enum snaphots ioctl returned %d and ret buflen is %d\n", 2180 + cifs_dbg(FYI, "enum snapshots ioctl returned %d and ret buflen is %d\n", 2181 2181 rc, ret_data_len); 2182 2182 if (rc) 2183 2183 return rc; ··· 2838 2838 2839 2839 static int 2840 2840 smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, 2841 - struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 2841 + const char *path, struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 2842 2842 { 2843 2843 struct smb2_query_info_rsp *rsp; 2844 2844 struct smb2_fs_full_size_info *info = NULL; ··· 2847 2847 int rc; 2848 2848 2849 2849 2850 - rc = smb2_query_info_compound(xid, tcon, "", 2850 + rc = smb2_query_info_compound(xid, tcon, path, 2851 2851 FILE_READ_ATTRIBUTES, 2852 2852 FS_FULL_SIZE_INFORMATION, 2853 2853 SMB2_O_INFO_FILESYSTEM, ··· 2875 2875 2876 2876 static int 2877 2877 smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon, 2878 - struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 2878 + const char *path, struct cifs_sb_info *cifs_sb, struct kstatfs *buf) 2879 2879 { 2880 2880 int rc; 2881 - __le16 srch_path = 0; /* Null - open root of share */ 2881 + __le16 *utf16_path = NULL; 2882 2882 u8 oplock = SMB2_OPLOCK_LEVEL_NONE; 2883 2883 struct cifs_open_parms oparms; 2884 2884 struct cifs_fid fid; 2885 2885 2886 2886 if (!tcon->posix_extensions) 2887 - return smb2_queryfs(xid, tcon, cifs_sb, buf); 2887 + return smb2_queryfs(xid, tcon, path, cifs_sb, buf); 2888 2888 2889 2889 oparms = (struct cifs_open_parms) { 2890 2890 .tcon = tcon, 2891 - .path = "", 2891 + .path = path, 2892 2892 .desired_access = FILE_READ_ATTRIBUTES, 2893 2893 .disposition = FILE_OPEN, 2894 2894 .create_options = cifs_create_options(cifs_sb, 0), 2895 2895 .fid = &fid, 2896 2896 }; 2897 2897 2898 - rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, 2898 + utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); 2899 + if (utf16_path == NULL) 2900 + return -ENOMEM; 2901 + 2902 + rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, 2899 2903 NULL, NULL); 2904 + kfree(utf16_path); 2900 2905 if (rc) 2901 2906 return rc; 2902 2907 ··· 3588 3583 /* 3589 3584 * At this point, we are trying to fallocate an internal 3590 3585 * regions of a sparse file. Since smb2 does not have a 3591 - * fallocate command we have two otions on how to emulate this. 3586 + * fallocate command we have two options on how to emulate this. 3592 3587 * We can either turn the entire file to become non-sparse 3593 3588 * which we only do if the fallocate is for virtually 3594 3589 * the whole file, or we can overwrite the region with zeroes
+2 -2
fs/smb/client/smb2pdu.c
··· 2986 2986 2987 2987 SMB2_close(xid, tcon, rsp->PersistentFileId, rsp->VolatileFileId); 2988 2988 2989 - /* Eventually save off posix specific response info and timestaps */ 2989 + /* Eventually save off posix specific response info and timestamps */ 2990 2990 2991 2991 err_free_rsp_buf: 2992 2992 free_rsp_buf(resp_buftype, rsp); ··· 4581 4581 } 4582 4582 #ifdef CONFIG_CIFS_SMB_DIRECT 4583 4583 /* 4584 - * If this rdata has a memmory registered, the MR can be freed 4584 + * If this rdata has a memory registered, the MR can be freed 4585 4585 * MR needs to be freed as soon as I/O finishes to prevent deadlock 4586 4586 * because they have limited number and are used for future I/Os 4587 4587 */
+1 -1
fs/smb/client/smb2proto.h
··· 291 291 extern void smb2_copy_fs_info_to_kstatfs( 292 292 struct smb2_fs_full_size_info *pfs_inf, 293 293 struct kstatfs *kst); 294 - extern int smb3_crypto_shash_allocate(struct TCP_Server_Info *server); 294 + extern int smb311_crypto_shash_allocate(struct TCP_Server_Info *server); 295 295 extern int smb311_update_preauth_hash(struct cifs_ses *ses, 296 296 struct TCP_Server_Info *server, 297 297 struct kvec *iov, int nvec);
+30 -2
fs/smb/client/smb2transport.c
··· 26 26 #include "../common/smb2status.h" 27 27 #include "smb2glob.h" 28 28 29 - int smb3_crypto_shash_allocate(struct TCP_Server_Info *server) 29 + static int 30 + smb3_crypto_shash_allocate(struct TCP_Server_Info *server) 30 31 { 31 32 struct cifs_secmech *p = &server->secmech; 32 33 int rc; ··· 45 44 cifs_free_hash(&p->hmacsha256); 46 45 return rc; 47 46 } 47 + 48 + int 49 + smb311_crypto_shash_allocate(struct TCP_Server_Info *server) 50 + { 51 + struct cifs_secmech *p = &server->secmech; 52 + int rc = 0; 53 + 54 + rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256); 55 + if (rc) 56 + return rc; 57 + 58 + rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac); 59 + if (rc) 60 + goto err; 61 + 62 + rc = cifs_alloc_hash("sha512", &p->sha512); 63 + if (rc) 64 + goto err; 65 + 66 + return 0; 67 + 68 + err: 69 + cifs_free_hash(&p->aes_cmac); 70 + cifs_free_hash(&p->hmacsha256); 71 + return rc; 72 + } 73 + 48 74 49 75 static 50 76 int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key) ··· 696 668 shdr->Command); 697 669 698 670 /* 699 - * Save off the origiginal signature so we can modify the smb and check 671 + * Save off the original signature so we can modify the smb and check 700 672 * our calculated signature against what the server sent. 701 673 */ 702 674 memcpy(server_response_sig, shdr->Signature, SMB2_SIGNATURE_SIZE);
+2 -2
fs/smb/client/smbdirect.c
··· 219 219 220 220 case RDMA_CM_EVENT_DEVICE_REMOVAL: 221 221 case RDMA_CM_EVENT_DISCONNECTED: 222 - /* This happenes when we fail the negotiation */ 222 + /* This happens when we fail the negotiation */ 223 223 if (info->transport_status == SMBD_NEGOTIATE_FAILED) { 224 224 info->transport_status = SMBD_DISCONNECTED; 225 225 wake_up(&info->conn_wait); ··· 1344 1344 * are not locked by srv_mutex. It is possible some processes are 1345 1345 * blocked on transport srv_mutex while holding memory registration. 1346 1346 * Release the transport srv_mutex to allow them to hit the failure 1347 - * path when sending data, and then release memory registartions. 1347 + * path when sending data, and then release memory registrations. 1348 1348 */ 1349 1349 log_rdma_event(INFO, "freeing mr list\n"); 1350 1350 wake_up_interruptible_all(&info->wait_mr);
+1 -1
fs/smb/client/smbdirect.h
··· 111 111 /* Used by transport to wait until all MRs are returned */ 112 112 wait_queue_head_t wait_for_mr_cleanup; 113 113 114 - /* Activity accoutning */ 114 + /* Activity accounting */ 115 115 atomic_t send_pending; 116 116 wait_queue_head_t wait_send_pending; 117 117 wait_queue_head_t wait_post_send;
+4 -3
fs/smb/common/smbfsctl.h
··· 140 140 /* Used by the DFS filter See MS-DFSC */ 141 141 #define IO_REPARSE_TAG_DFSR 0x80000012 142 142 #define IO_REPARSE_TAG_FILTER_MANAGER 0x8000000B 143 - /* See section MS-FSCC 2.1.2.4 */ 143 + /* Native SMB symlinks since Windows Vista, see MS-FSCC 2.1.2.4 */ 144 144 #define IO_REPARSE_TAG_SYMLINK 0xA000000C 145 145 #define IO_REPARSE_TAG_DEDUP 0x80000013 146 146 #define IO_REPARSE_APPXSTREAM 0xC0000014 147 - /* NFS symlinks, Win 8/SMB3 and later */ 147 + /* NFS special files used by Windows NFS server since Windows Server 2012, see MS-FSCC 2.1.2.6 */ 148 148 #define IO_REPARSE_TAG_NFS 0x80000014 149 149 /* 150 150 * AzureFileSync - see 151 151 * https://docs.microsoft.com/en-us/azure/storage/files/storage-sync-cloud-tiering 152 152 */ 153 153 #define IO_REPARSE_TAG_AZ_FILE_SYNC 0x8000001e 154 + /* Native Win32 AF_UNIX sockets since Windows 10 April 2018 Update, used also by WSL */ 155 + #define IO_REPARSE_TAG_AF_UNIX 0x80000023 154 156 /* WSL reparse tags */ 155 157 #define IO_REPARSE_TAG_LX_SYMLINK 0xA000001D 156 - #define IO_REPARSE_TAG_AF_UNIX 0x80000023 157 158 #define IO_REPARSE_TAG_LX_FIFO 0x80000024 158 159 #define IO_REPARSE_TAG_LX_CHR 0x80000025 159 160 #define IO_REPARSE_TAG_LX_BLK 0x80000026