diff options
| -rw-r--r-- | fs/cifs/cifs_unicode.c | 3 | ||||
| -rw-r--r-- | fs/cifs/connect.c | 2 | ||||
| -rw-r--r-- | fs/cifs/inode.c | 2 | ||||
| -rw-r--r-- | fs/cifs/smb2misc.c | 14 | ||||
| -rw-r--r-- | fs/cifs/smb2ops.c | 35 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 3 |
6 files changed, 40 insertions, 19 deletions
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index b380e0871372..a2b2355e7f01 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
| @@ -105,9 +105,6 @@ convert_sfm_char(const __u16 src_char, char *target) | |||
| 105 | case SFM_LESSTHAN: | 105 | case SFM_LESSTHAN: |
| 106 | *target = '<'; | 106 | *target = '<'; |
| 107 | break; | 107 | break; |
| 108 | case SFM_SLASH: | ||
| 109 | *target = '\\'; | ||
| 110 | break; | ||
| 111 | case SFM_SPACE: | 108 | case SFM_SPACE: |
| 112 | *target = ' '; | 109 | *target = ' '; |
| 113 | break; | 110 | break; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index c832a8a1970a..7aa08dba4719 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -2547,7 +2547,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
| 2547 | if (tcon == NULL) | 2547 | if (tcon == NULL) |
| 2548 | return -ENOMEM; | 2548 | return -ENOMEM; |
| 2549 | 2549 | ||
| 2550 | snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->serverName); | 2550 | snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->server->hostname); |
| 2551 | 2551 | ||
| 2552 | /* cannot fail */ | 2552 | /* cannot fail */ |
| 2553 | nls_codepage = load_nls_default(); | 2553 | nls_codepage = load_nls_default(); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index d32eaa4b2437..6e8765f44508 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -467,6 +467,8 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, | |||
| 467 | oparms.cifs_sb = cifs_sb; | 467 | oparms.cifs_sb = cifs_sb; |
| 468 | oparms.desired_access = GENERIC_READ; | 468 | oparms.desired_access = GENERIC_READ; |
| 469 | oparms.create_options = CREATE_NOT_DIR; | 469 | oparms.create_options = CREATE_NOT_DIR; |
| 470 | if (backup_cred(cifs_sb)) | ||
| 471 | oparms.create_options |= CREATE_OPEN_BACKUP_INTENT; | ||
| 470 | oparms.disposition = FILE_OPEN; | 472 | oparms.disposition = FILE_OPEN; |
| 471 | oparms.path = path; | 473 | oparms.path = path; |
| 472 | oparms.fid = &fid; | 474 | oparms.fid = &fid; |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index db0453660ff6..6a9c47541c53 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
| @@ -248,16 +248,20 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr) | |||
| 248 | * MacOS server pads after SMB2.1 write response with 3 bytes | 248 | * MacOS server pads after SMB2.1 write response with 3 bytes |
| 249 | * of junk. Other servers match RFC1001 len to actual | 249 | * of junk. Other servers match RFC1001 len to actual |
| 250 | * SMB2/SMB3 frame length (header + smb2 response specific data) | 250 | * SMB2/SMB3 frame length (header + smb2 response specific data) |
| 251 | * Some windows servers do too when compounding is used. | 251 | * Some windows servers also pad up to 8 bytes when compounding. |
| 252 | * Log the server error (once), but allow it and continue | 252 | * If pad is longer than eight bytes, log the server behavior |
| 253 | * (once), since may indicate a problem but allow it and continue | ||
| 253 | * since the frame is parseable. | 254 | * since the frame is parseable. |
| 254 | */ | 255 | */ |
| 255 | if (clc_len < len) { | 256 | if (clc_len < len) { |
| 256 | printk_once(KERN_WARNING | 257 | pr_warn_once( |
| 257 | "SMB2 server sent bad RFC1001 len %d not %d\n", | 258 | "srv rsp padded more than expected. Length %d not %d for cmd:%d mid:%llu\n", |
| 258 | len, clc_len); | 259 | len, clc_len, command, mid); |
| 259 | return 0; | 260 | return 0; |
| 260 | } | 261 | } |
| 262 | pr_warn_once( | ||
| 263 | "srv rsp too short, len %d not %d. cmd:%d mid:%llu\n", | ||
| 264 | len, clc_len, command, mid); | ||
| 261 | 265 | ||
| 262 | return 1; | 266 | return 1; |
| 263 | } | 267 | } |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 247a98e6c856..d954ce36b473 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
| @@ -630,7 +630,10 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 630 | oparms.tcon = tcon; | 630 | oparms.tcon = tcon; |
| 631 | oparms.desired_access = FILE_READ_ATTRIBUTES; | 631 | oparms.desired_access = FILE_READ_ATTRIBUTES; |
| 632 | oparms.disposition = FILE_OPEN; | 632 | oparms.disposition = FILE_OPEN; |
| 633 | oparms.create_options = 0; | 633 | if (backup_cred(cifs_sb)) |
| 634 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
| 635 | else | ||
| 636 | oparms.create_options = 0; | ||
| 634 | oparms.fid = &fid; | 637 | oparms.fid = &fid; |
| 635 | oparms.reconnect = false; | 638 | oparms.reconnect = false; |
| 636 | 639 | ||
| @@ -779,7 +782,10 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 779 | oparms.tcon = tcon; | 782 | oparms.tcon = tcon; |
| 780 | oparms.desired_access = FILE_READ_EA; | 783 | oparms.desired_access = FILE_READ_EA; |
| 781 | oparms.disposition = FILE_OPEN; | 784 | oparms.disposition = FILE_OPEN; |
| 782 | oparms.create_options = 0; | 785 | if (backup_cred(cifs_sb)) |
| 786 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
| 787 | else | ||
| 788 | oparms.create_options = 0; | ||
| 783 | oparms.fid = &fid; | 789 | oparms.fid = &fid; |
| 784 | oparms.reconnect = false; | 790 | oparms.reconnect = false; |
| 785 | 791 | ||
| @@ -858,7 +864,10 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 858 | oparms.tcon = tcon; | 864 | oparms.tcon = tcon; |
| 859 | oparms.desired_access = FILE_WRITE_EA; | 865 | oparms.desired_access = FILE_WRITE_EA; |
| 860 | oparms.disposition = FILE_OPEN; | 866 | oparms.disposition = FILE_OPEN; |
| 861 | oparms.create_options = 0; | 867 | if (backup_cred(cifs_sb)) |
| 868 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
| 869 | else | ||
| 870 | oparms.create_options = 0; | ||
| 862 | oparms.fid = &fid; | 871 | oparms.fid = &fid; |
| 863 | oparms.reconnect = false; | 872 | oparms.reconnect = false; |
| 864 | 873 | ||
| @@ -1453,7 +1462,10 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1453 | oparms.tcon = tcon; | 1462 | oparms.tcon = tcon; |
| 1454 | oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; | 1463 | oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; |
| 1455 | oparms.disposition = FILE_OPEN; | 1464 | oparms.disposition = FILE_OPEN; |
| 1456 | oparms.create_options = 0; | 1465 | if (backup_cred(cifs_sb)) |
| 1466 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
| 1467 | else | ||
| 1468 | oparms.create_options = 0; | ||
| 1457 | oparms.fid = fid; | 1469 | oparms.fid = fid; |
| 1458 | oparms.reconnect = false; | 1470 | oparms.reconnect = false; |
| 1459 | 1471 | ||
| @@ -1857,7 +1869,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1857 | oparms.tcon = tcon; | 1869 | oparms.tcon = tcon; |
| 1858 | oparms.desired_access = FILE_READ_ATTRIBUTES; | 1870 | oparms.desired_access = FILE_READ_ATTRIBUTES; |
| 1859 | oparms.disposition = FILE_OPEN; | 1871 | oparms.disposition = FILE_OPEN; |
| 1860 | oparms.create_options = 0; | 1872 | if (backup_cred(cifs_sb)) |
| 1873 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
| 1874 | else | ||
| 1875 | oparms.create_options = 0; | ||
| 1861 | oparms.fid = &fid; | 1876 | oparms.fid = &fid; |
| 1862 | oparms.reconnect = false; | 1877 | oparms.reconnect = false; |
| 1863 | 1878 | ||
| @@ -3639,7 +3654,7 @@ struct smb_version_values smb21_values = { | |||
| 3639 | struct smb_version_values smb3any_values = { | 3654 | struct smb_version_values smb3any_values = { |
| 3640 | .version_string = SMB3ANY_VERSION_STRING, | 3655 | .version_string = SMB3ANY_VERSION_STRING, |
| 3641 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ | 3656 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ |
| 3642 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3657 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
| 3643 | .large_lock_type = 0, | 3658 | .large_lock_type = 0, |
| 3644 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3659 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
| 3645 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3660 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
| @@ -3660,7 +3675,7 @@ struct smb_version_values smb3any_values = { | |||
| 3660 | struct smb_version_values smbdefault_values = { | 3675 | struct smb_version_values smbdefault_values = { |
| 3661 | .version_string = SMBDEFAULT_VERSION_STRING, | 3676 | .version_string = SMBDEFAULT_VERSION_STRING, |
| 3662 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ | 3677 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ |
| 3663 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3678 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
| 3664 | .large_lock_type = 0, | 3679 | .large_lock_type = 0, |
| 3665 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3680 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
| 3666 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3681 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
| @@ -3681,7 +3696,7 @@ struct smb_version_values smbdefault_values = { | |||
| 3681 | struct smb_version_values smb30_values = { | 3696 | struct smb_version_values smb30_values = { |
| 3682 | .version_string = SMB30_VERSION_STRING, | 3697 | .version_string = SMB30_VERSION_STRING, |
| 3683 | .protocol_id = SMB30_PROT_ID, | 3698 | .protocol_id = SMB30_PROT_ID, |
| 3684 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3699 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
| 3685 | .large_lock_type = 0, | 3700 | .large_lock_type = 0, |
| 3686 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3701 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
| 3687 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3702 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
| @@ -3702,7 +3717,7 @@ struct smb_version_values smb30_values = { | |||
| 3702 | struct smb_version_values smb302_values = { | 3717 | struct smb_version_values smb302_values = { |
| 3703 | .version_string = SMB302_VERSION_STRING, | 3718 | .version_string = SMB302_VERSION_STRING, |
| 3704 | .protocol_id = SMB302_PROT_ID, | 3719 | .protocol_id = SMB302_PROT_ID, |
| 3705 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3720 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
| 3706 | .large_lock_type = 0, | 3721 | .large_lock_type = 0, |
| 3707 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3722 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
| 3708 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3723 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
| @@ -3723,7 +3738,7 @@ struct smb_version_values smb302_values = { | |||
| 3723 | struct smb_version_values smb311_values = { | 3738 | struct smb_version_values smb311_values = { |
| 3724 | .version_string = SMB311_VERSION_STRING, | 3739 | .version_string = SMB311_VERSION_STRING, |
| 3725 | .protocol_id = SMB311_PROT_ID, | 3740 | .protocol_id = SMB311_PROT_ID, |
| 3726 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3741 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
| 3727 | .large_lock_type = 0, | 3742 | .large_lock_type = 0, |
| 3728 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3743 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
| 3729 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3744 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 5740aa809be6..c08acfc77abc 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -2178,6 +2178,9 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock, | |||
| 2178 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || | 2178 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || |
| 2179 | *oplock == SMB2_OPLOCK_LEVEL_NONE) | 2179 | *oplock == SMB2_OPLOCK_LEVEL_NONE) |
| 2180 | req->RequestedOplockLevel = *oplock; | 2180 | req->RequestedOplockLevel = *oplock; |
| 2181 | else if (!(server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) && | ||
| 2182 | (oparms->create_options & CREATE_NOT_FILE)) | ||
| 2183 | req->RequestedOplockLevel = *oplock; /* no srv lease support */ | ||
| 2181 | else { | 2184 | else { |
| 2182 | rc = add_lease_context(server, iov, &n_iov, | 2185 | rc = add_lease_context(server, iov, &n_iov, |
| 2183 | oparms->fid->lease_key, oplock); | 2186 | oparms->fid->lease_key, oplock); |
