Pull cifs client fixes from Steve French: "Nine cifs/smb3 client fixes. Includes DFS fixes, some cleanup of leagcy SMB1 code, duplicated message cleanup and a double free and deadlock fix" * tag '5.19-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix uninitialized pointer in error case in dfs_cache_get_tgt_share cifs: skip trailing separators of prefix paths cifs: update internal module number cifs: version operations for smb20 unneeded when legacy support disabled cifs: do not build smb1ops if legacy support is disabled cifs: fix potential deadlock in direct reclaim cifs: when extending a file with falloc we should make files not-sparse cifs: remove repeated debug message on cifs_put_smb_ses() cifs: fix potential double free during failed mount
Unified · Split
| @@ -8,7 +8,7 @@ obj-$(CONFIG_CIFS) += cifs.o · 7 unmodified lines | |||
| 8 | cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \ | 8 | cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \ |
| 9 | inode.o link.o misc.o netmisc.o smbencrypt.o transport.o \ | 9 | inode.o link.o misc.o netmisc.o smbencrypt.o transport.o \ |
| 10 | cifs_unicode.o nterr.o cifsencrypt.o \ | 10 | cifs_unicode.o nterr.o cifsencrypt.o \ |
| 11 | readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \ | 11 | readdir.o ioctl.o sess.o export.o unc.o winucase.o \ |
| 12 | smb2ops.o smb2maperror.o smb2transport.o \ | 12 | smb2ops.o smb2maperror.o smb2transport.o \ |
| 13 | smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \ | 13 | smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \ |
| 14 | dns_resolve.o cifs_spnego_negtokeninit.asn1.o asn1.o | 14 | dns_resolve.o cifs_spnego_negtokeninit.asn1.o asn1.o |
| @@ -30,3 +30,5 @@ cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o · 15 unmodified lines | |||
| 30 | cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o | 30 | cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o |
| 31 | 31 | ||
| 32 | cifs-$(CONFIG_CIFS_ROOT) += cifsroot.o | 32 | cifs-$(CONFIG_CIFS_ROOT) += cifsroot.o |
| 33 | |||
| 34 | cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += smb1ops.o | ||
| @@ -465,7 +465,7 @@ static int cifs_swn_reconnect(struct cifs_tcon *tcon, struct sockaddr_storage *a · 464 unmodified lines | |||
| 465 | int ret = 0; | 465 | int ret = 0; |
| 466 | 466 | ||
| 467 | /* Store the reconnect address */ | 467 | /* Store the reconnect address */ |
| 468 | mutex_lock(&tcon->ses->server->srv_mutex); | 468 | cifs_server_lock(tcon->ses->server); |
| 469 | if (cifs_sockaddr_equal(&tcon->ses->server->dstaddr, addr)) | 469 | if (cifs_sockaddr_equal(&tcon->ses->server->dstaddr, addr)) |
| 470 | goto unlock; | 470 | goto unlock; |
| 471 | 471 | ||
| @@ -501,7 +501,7 @@ static int cifs_swn_reconnect(struct cifs_tcon *tcon, struct sockaddr_storage *a · 29 unmodified lines | |||
| 501 | cifs_signal_cifsd_for_reconnect(tcon->ses->server, false); | 501 | cifs_signal_cifsd_for_reconnect(tcon->ses->server, false); |
| 502 | 502 | ||
| 503 | unlock: | 503 | unlock: |
| 504 | mutex_unlock(&tcon->ses->server->srv_mutex); | 504 | cifs_server_unlock(tcon->ses->server); |
| 505 | 505 | ||
| 506 | return ret; | 506 | return ret; |
| 507 | } | 507 | } |
| @@ -236,9 +236,9 @@ int cifs_verify_signature(struct smb_rqst *rqst, · 235 unmodified lines | |||
| 236 | cpu_to_le32(expected_sequence_number); | 236 | cpu_to_le32(expected_sequence_number); |
| 237 | cifs_pdu->Signature.Sequence.Reserved = 0; | 237 | cifs_pdu->Signature.Sequence.Reserved = 0; |
| 238 | 238 | ||
| 239 | mutex_lock(&server->srv_mutex); | 239 | cifs_server_lock(server); |
| 240 | rc = cifs_calc_signature(rqst, server, what_we_think_sig_should_be); | 240 | rc = cifs_calc_signature(rqst, server, what_we_think_sig_should_be); |
| 241 | mutex_unlock(&server->srv_mutex); | 241 | cifs_server_unlock(server); |
| 242 | 242 | ||
| 243 | if (rc) | 243 | if (rc) |
| 244 | return rc; | 244 | return rc; |
| @@ -626,7 +626,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) · 381 unmodified lines | |||
| 626 | 626 | ||
| 627 | memcpy(ses->auth_key.response + baselen, tiblob, tilen); | 627 | memcpy(ses->auth_key.response + baselen, tiblob, tilen); |
| 628 | 628 | ||
| 629 | mutex_lock(&ses->server->srv_mutex); | 629 | cifs_server_lock(ses->server); |
| 630 | 630 | ||
| 631 | rc = cifs_alloc_hash("hmac(md5)", | 631 | rc = cifs_alloc_hash("hmac(md5)", |
| 632 | &ses->server->secmech.hmacmd5, | 632 | &ses->server->secmech.hmacmd5, |
| @@ -678,7 +678,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) · 45 unmodified lines | |||
| 678 | cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); | 678 | cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); |
| 679 | 679 | ||
| 680 | unlock: | 680 | unlock: |
| 681 | mutex_unlock(&ses->server->srv_mutex); | 681 | cifs_server_unlock(ses->server); |
| 682 | setup_ntlmv2_rsp_ret: | 682 | setup_ntlmv2_rsp_ret: |
| 683 | kfree(tiblob); | 683 | kfree(tiblob); |
| 684 | 684 | ||
| @@ -838,7 +838,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, · 837 unmodified lines | |||
| 838 | int flags, struct smb3_fs_context *old_ctx) | 838 | int flags, struct smb3_fs_context *old_ctx) |
| 839 | { | 839 | { |
| 840 | int rc; | 840 | int rc; |
| 841 | struct super_block *sb; | 841 | struct super_block *sb = NULL; |
| 842 | struct cifs_sb_info *cifs_sb = NULL; | 842 | struct cifs_sb_info *cifs_sb = NULL; |
| 843 | struct cifs_mnt_data mnt_data; | 843 | struct cifs_mnt_data mnt_data; |
| 844 | struct dentry *root; | 844 | struct dentry *root; |
| @@ -934,9 +934,11 @@ out_super: · 89 unmodified lines | |||
| 934 | return root; | 934 | return root; |
| 935 | out: | 935 | out: |
| 936 | if (cifs_sb) { | 936 | if (cifs_sb) { |
| 937 | kfree(cifs_sb->prepath); | 937 | if (!sb || IS_ERR(sb)) { /* otherwise kill_sb will handle */ |
| 938 | smb3_cleanup_fs_context(cifs_sb->ctx); | 938 | kfree(cifs_sb->prepath); |
| 939 | kfree(cifs_sb); | 939 | smb3_cleanup_fs_context(cifs_sb->ctx); |
| 940 | kfree(cifs_sb); | ||
| 941 | } | ||
| 940 | } | 942 | } |
| 941 | return root; | 943 | return root; |
| 942 | } | 944 | } |
| @@ -152,6 +152,7 @@ extern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type, · 151 unmodified lines | |||
| 152 | extern const struct export_operations cifs_export_ops; | 152 | extern const struct export_operations cifs_export_ops; |
| 153 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 153 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
| 154 | 154 | ||
| 155 | #define SMB3_PRODUCT_BUILD 35 | 155 | /* when changing internal version - update following two lines at same time */ |
| 156 | #define CIFS_VERSION "2.36" | 156 | #define SMB3_PRODUCT_BUILD 37 |
| 157 | #define CIFS_VERSION "2.37" | ||
| 157 | #endif /* _CIFSFS_H */ | 158 | #endif /* _CIFSFS_H */ |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <linux/mempool.h> | 16 | #include <linux/mempool.h> |
| 17 | #include <linux/workqueue.h> | 17 | #include <linux/workqueue.h> |
| 18 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
| 19 | #include <linux/sched/mm.h> | ||
| 19 | #include <linux/netfs.h> | 20 | #include <linux/netfs.h> |
| 20 | #include "cifs_fs_sb.h" | 21 | #include "cifs_fs_sb.h" |
| 21 | #include "cifsacl.h" | 22 | #include "cifsacl.h" |
| @@ -628,7 +629,8 @@ struct TCP_Server_Info { · 606 unmodified lines | |||
| 628 | unsigned int in_flight; /* number of requests on the wire to server */ | 629 | unsigned int in_flight; /* number of requests on the wire to server */ |
| 629 | unsigned int max_in_flight; /* max number of requests that were on wire */ | 630 | unsigned int max_in_flight; /* max number of requests that were on wire */ |
| 630 | spinlock_t req_lock; /* protect the two values above */ | 631 | spinlock_t req_lock; /* protect the two values above */ |
| 631 | struct mutex srv_mutex; | 632 | struct mutex _srv_mutex; |
| 633 | unsigned int nofs_flag; | ||
| 632 | struct task_struct *tsk; | 634 | struct task_struct *tsk; |
| 633 | char server_GUID[16]; | 635 | char server_GUID[16]; |
| 634 | __u16 sec_mode; | 636 | __u16 sec_mode; |
| @@ -743,6 +745,22 @@ struct TCP_Server_Info { · 108 unmodified lines | |||
| 743 | #endif | 745 | #endif |
| 744 | }; | 746 | }; |
| 745 | 747 | ||
| 748 | static inline void cifs_server_lock(struct TCP_Server_Info *server) | ||
| 749 | { | ||
| 750 | unsigned int nofs_flag = memalloc_nofs_save(); | ||
| 751 | |||
| 752 | mutex_lock(&server->_srv_mutex); | ||
| 753 | server->nofs_flag = nofs_flag; | ||
| 754 | } | ||
| 755 | |||
| 756 | static inline void cifs_server_unlock(struct TCP_Server_Info *server) | ||
| 757 | { | ||
| 758 | unsigned int nofs_flag = server->nofs_flag; | ||
| 759 | |||
| 760 | mutex_unlock(&server->_srv_mutex); | ||
| 761 | memalloc_nofs_restore(nofs_flag); | ||
| 762 | } | ||
| 763 | |||
| 746 | struct cifs_credits { | 764 | struct cifs_credits { |
| 747 | unsigned int value; | 765 | unsigned int value; |
| 748 | unsigned int instance; | 766 | unsigned int instance; |
| @@ -1945,11 +1963,13 @@ extern mempool_t *cifs_mid_poolp; · 1196 unmodified lines | |||
| 1945 | 1963 | ||
| 1946 | /* Operations for different SMB versions */ | 1964 | /* Operations for different SMB versions */ |
| 1947 | #define SMB1_VERSION_STRING "1.0" | 1965 | #define SMB1_VERSION_STRING "1.0" |
| 1966 | #define SMB20_VERSION_STRING "2.0" | ||
| 1967 | #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY | ||
| 1948 | extern struct smb_version_operations smb1_operations; | 1968 | extern struct smb_version_operations smb1_operations; |
| 1949 | extern struct smb_version_values smb1_values; | 1969 | extern struct smb_version_values smb1_values; |
| 1950 | #define SMB20_VERSION_STRING "2.0" | ||
| 1951 | extern struct smb_version_operations smb20_operations; | 1970 | extern struct smb_version_operations smb20_operations; |
| 1952 | extern struct smb_version_values smb20_values; | 1971 | extern struct smb_version_values smb20_values; |
| 1972 | #endif /* CIFS_ALLOW_INSECURE_LEGACY */ | ||
| 1953 | #define SMB21_VERSION_STRING "2.1" | 1973 | #define SMB21_VERSION_STRING "2.1" |
| 1954 | extern struct smb_version_operations smb21_operations; | 1974 | extern struct smb_version_operations smb21_operations; |
| 1955 | extern struct smb_version_values smb21_values; | 1975 | extern struct smb_version_values smb21_values; |
| @@ -148,7 +148,7 @@ static void cifs_resolve_server(struct work_struct *work) · 147 unmodified lines | |||
| 148 | struct TCP_Server_Info *server = container_of(work, | 148 | struct TCP_Server_Info *server = container_of(work, |
| 149 | struct TCP_Server_Info, resolve.work); | 149 | struct TCP_Server_Info, resolve.work); |
| 150 | 150 | ||
| 151 | mutex_lock(&server->srv_mutex); | 151 | cifs_server_lock(server); |
| 152 | 152 | ||
| 153 | /* | 153 | /* |
| 154 | * Resolve the hostname again to make sure that IP address is up-to-date. | 154 | * Resolve the hostname again to make sure that IP address is up-to-date. |
| @@ -159,7 +159,7 @@ static void cifs_resolve_server(struct work_struct *work) · 4 unmodified lines | |||
| 159 | __func__, rc); | 159 | __func__, rc); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | mutex_unlock(&server->srv_mutex); | 162 | cifs_server_unlock(server); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | /* | 165 | /* |
| @@ -267,7 +267,7 @@ cifs_abort_connection(struct TCP_Server_Info *server) · 101 unmodified lines | |||
| 267 | 267 | ||
| 268 | /* do not want to be sending data on a socket we are freeing */ | 268 | /* do not want to be sending data on a socket we are freeing */ |
| 269 | cifs_dbg(FYI, "%s: tearing down socket\n", __func__); | 269 | cifs_dbg(FYI, "%s: tearing down socket\n", __func__); |
| 270 | mutex_lock(&server->srv_mutex); | 270 | cifs_server_lock(server); |
| 271 | if (server->ssocket) { | 271 | if (server->ssocket) { |
| 272 | cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n", server->ssocket->state, | 272 | cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n", server->ssocket->state, |
| 273 | server->ssocket->flags); | 273 | server->ssocket->flags); |
| @@ -296,7 +296,7 @@ cifs_abort_connection(struct TCP_Server_Info *server) · 22 unmodified lines | |||
| 296 | mid->mid_flags |= MID_DELETED; | 296 | mid->mid_flags |= MID_DELETED; |
| 297 | } | 297 | } |
| 298 | spin_unlock(&GlobalMid_Lock); | 298 | spin_unlock(&GlobalMid_Lock); |
| 299 | mutex_unlock(&server->srv_mutex); | 299 | cifs_server_unlock(server); |
| 300 | 300 | ||
| 301 | cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__); | 301 | cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__); |
| 302 | list_for_each_entry_safe(mid, nmid, &retry_list, qhead) { | 302 | list_for_each_entry_safe(mid, nmid, &retry_list, qhead) { |
| @@ -306,9 +306,9 @@ cifs_abort_connection(struct TCP_Server_Info *server) · 3 unmodified lines | |||
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | if (cifs_rdma_enabled(server)) { | 308 | if (cifs_rdma_enabled(server)) { |
| 309 | mutex_lock(&server->srv_mutex); | 309 | cifs_server_lock(server); |
| 310 | smbd_destroy(server); | 310 | smbd_destroy(server); |
| 311 | mutex_unlock(&server->srv_mutex); | 311 | cifs_server_unlock(server); |
| 312 | } | 312 | } |
| 313 | } | 313 | } |
| 314 | 314 | ||
| @@ -359,7 +359,7 @@ static int __cifs_reconnect(struct TCP_Server_Info *server, · 44 unmodified lines | |||
| 359 | 359 | ||
| 360 | do { | 360 | do { |
| 361 | try_to_freeze(); | 361 | try_to_freeze(); |
| 362 | mutex_lock(&server->srv_mutex); | 362 | cifs_server_lock(server); |
| 363 | 363 | ||
| 364 | if (!cifs_swn_set_server_dstaddr(server)) { | 364 | if (!cifs_swn_set_server_dstaddr(server)) { |
| 365 | /* resolve the hostname again to make sure that IP address is up-to-date */ | 365 | /* resolve the hostname again to make sure that IP address is up-to-date */ |
| @@ -372,7 +372,7 @@ static int __cifs_reconnect(struct TCP_Server_Info *server, · 6 unmodified lines | |||
| 372 | else | 372 | else |
| 373 | rc = generic_ip_connect(server); | 373 | rc = generic_ip_connect(server); |
| 374 | if (rc) { | 374 | if (rc) { |
| 375 | mutex_unlock(&server->srv_mutex); | 375 | cifs_server_unlock(server); |
| 376 | cifs_dbg(FYI, "%s: reconnect error %d\n", __func__, rc); | 376 | cifs_dbg(FYI, "%s: reconnect error %d\n", __func__, rc); |
| 377 | msleep(3000); | 377 | msleep(3000); |
| 378 | } else { | 378 | } else { |
| @@ -383,7 +383,7 @@ static int __cifs_reconnect(struct TCP_Server_Info *server, · 4 unmodified lines | |||
| 383 | server->tcpStatus = CifsNeedNegotiate; | 383 | server->tcpStatus = CifsNeedNegotiate; |
| 384 | spin_unlock(&cifs_tcp_ses_lock); | 384 | spin_unlock(&cifs_tcp_ses_lock); |
| 385 | cifs_swn_reset_server_dstaddr(server); | 385 | cifs_swn_reset_server_dstaddr(server); |
| 386 | mutex_unlock(&server->srv_mutex); | 386 | cifs_server_unlock(server); |
| 387 | mod_delayed_work(cifsiod_wq, &server->reconnect, 0); | 387 | mod_delayed_work(cifsiod_wq, &server->reconnect, 0); |
| 388 | } | 388 | } |
| 389 | } while (server->tcpStatus == CifsNeedReconnect); | 389 | } while (server->tcpStatus == CifsNeedReconnect); |
| @@ -488,12 +488,12 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server) · 98 unmodified lines | |||
| 488 | 488 | ||
| 489 | do { | 489 | do { |
| 490 | try_to_freeze(); | 490 | try_to_freeze(); |
| 491 | mutex_lock(&server->srv_mutex); | 491 | cifs_server_lock(server); |
| 492 | 492 | ||
| 493 | rc = reconnect_target_unlocked(server, &tl, &target_hint); | 493 | rc = reconnect_target_unlocked(server, &tl, &target_hint); |
| 494 | if (rc) { | 494 | if (rc) { |
| 495 | /* Failed to reconnect socket */ | 495 | /* Failed to reconnect socket */ |
| 496 | mutex_unlock(&server->srv_mutex); | 496 | cifs_server_unlock(server); |
| 497 | cifs_dbg(FYI, "%s: reconnect error %d\n", __func__, rc); | 497 | cifs_dbg(FYI, "%s: reconnect error %d\n", __func__, rc); |
| 498 | msleep(3000); | 498 | msleep(3000); |
| 499 | continue; | 499 | continue; |
| @@ -510,7 +510,7 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server) · 10 unmodified lines | |||
| 510 | server->tcpStatus = CifsNeedNegotiate; | 510 | server->tcpStatus = CifsNeedNegotiate; |
| 511 | spin_unlock(&cifs_tcp_ses_lock); | 511 | spin_unlock(&cifs_tcp_ses_lock); |
| 512 | cifs_swn_reset_server_dstaddr(server); | 512 | cifs_swn_reset_server_dstaddr(server); |
| 513 | mutex_unlock(&server->srv_mutex); | 513 | cifs_server_unlock(server); |
| 514 | mod_delayed_work(cifsiod_wq, &server->reconnect, 0); | 514 | mod_delayed_work(cifsiod_wq, &server->reconnect, 0); |
| 515 | } while (server->tcpStatus == CifsNeedReconnect); | 515 | } while (server->tcpStatus == CifsNeedReconnect); |
| 516 | 516 | ||
| @@ -1565,7 +1565,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, · 1048 unmodified lines | |||
| 1565 | init_waitqueue_head(&tcp_ses->response_q); | 1565 | init_waitqueue_head(&tcp_ses->response_q); |
| 1566 | init_waitqueue_head(&tcp_ses->request_q); | 1566 | init_waitqueue_head(&tcp_ses->request_q); |
| 1567 | INIT_LIST_HEAD(&tcp_ses->pending_mid_q); | 1567 | INIT_LIST_HEAD(&tcp_ses->pending_mid_q); |
| 1568 | mutex_init(&tcp_ses->srv_mutex); | 1568 | mutex_init(&tcp_ses->_srv_mutex); |
| 1569 | memcpy(tcp_ses->workstation_RFC1001_name, | 1569 | memcpy(tcp_ses->workstation_RFC1001_name, |
| 1570 | ctx->source_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); | 1570 | ctx->source_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); |
| 1571 | memcpy(tcp_ses->server_RFC1001_name, | 1571 | memcpy(tcp_ses->server_RFC1001_name, |
| @@ -1845,7 +1845,6 @@ void cifs_put_smb_ses(struct cifs_ses *ses) · 273 unmodified lines | |||
| 1845 | unsigned int rc, xid; | 1845 | unsigned int rc, xid; |
| 1846 | unsigned int chan_count; | 1846 | unsigned int chan_count; |
| 1847 | struct TCP_Server_Info *server = ses->server; | 1847 | struct TCP_Server_Info *server = ses->server; |
| 1848 | cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count); | ||
| 1849 | 1848 | ||
| 1850 | spin_lock(&cifs_tcp_ses_lock); | 1849 | spin_lock(&cifs_tcp_ses_lock); |
| 1851 | if (ses->ses_status == SES_EXITING) { | 1850 | if (ses->ses_status == SES_EXITING) { |
| @@ -1229,6 +1229,30 @@ void dfs_cache_put_refsrv_sessions(const uuid_t *mount_id) · 1228 unmodified lines | |||
| 1229 | kref_put(&mg->refcount, mount_group_release); | 1229 | kref_put(&mg->refcount, mount_group_release); |
| 1230 | } | 1230 | } |
| 1231 | 1231 | ||
| 1232 | /* Extract share from DFS target and return a pointer to prefix path or NULL */ | ||
| 1233 | static const char *parse_target_share(const char *target, char **share) | ||
| 1234 | { | ||
| 1235 | const char *s, *seps = "/\\"; | ||
| 1236 | size_t len; | ||
| 1237 | |||
| 1238 | s = strpbrk(target + 1, seps); | ||
| 1239 | if (!s) | ||
| 1240 | return ERR_PTR(-EINVAL); | ||
| 1241 | |||
| 1242 | len = strcspn(s + 1, seps); | ||
| 1243 | if (!len) | ||
| 1244 | return ERR_PTR(-EINVAL); | ||
| 1245 | s += len; | ||
| 1246 | |||
| 1247 | len = s - target + 1; | ||
| 1248 | *share = kstrndup(target, len, GFP_KERNEL); | ||
| 1249 | if (!*share) | ||
| 1250 | return ERR_PTR(-ENOMEM); | ||
| 1251 | |||
| 1252 | s = target + len; | ||
| 1253 | return s + strspn(s, seps); | ||
| 1254 | } | ||
| 1255 | |||
| 1232 | /** | 1256 | /** |
| 1233 | * dfs_cache_get_tgt_share - parse a DFS target | 1257 | * dfs_cache_get_tgt_share - parse a DFS target |
| 1234 | * | 1258 | * |
| @@ -1242,56 +1266,46 @@ void dfs_cache_put_refsrv_sessions(const uuid_t *mount_id) · 7 unmodified lines | |||
| 1242 | int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share, | 1266 | int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share, |
| 1243 | char **prefix) | 1267 | char **prefix) |
| 1244 | { | 1268 | { |
| 1245 | char *s, sep, *p; | 1269 | char sep; |
| 1246 | size_t len; | 1270 | char *target_share; |
| 1247 | size_t plen1, plen2; | 1271 | char *ppath = NULL; |
| 1272 | const char *target_ppath, *dfsref_ppath; | ||
| 1273 | size_t target_pplen, dfsref_pplen; | ||
| 1274 | size_t len, c; | ||
| 1248 | 1275 | ||
| 1249 | if (!it || !path || !share || !prefix || strlen(path) < it->it_path_consumed) | 1276 | if (!it || !path || !share || !prefix || strlen(path) < it->it_path_consumed) |
| 1250 | return -EINVAL; | 1277 | return -EINVAL; |
| 1251 | 1278 | ||
| 1252 | *share = NULL; | ||
| 1253 | *prefix = NULL; | ||
| 1254 | |||
| 1255 | sep = it->it_name[0]; | 1279 | sep = it->it_name[0]; |
| 1256 | if (sep != '\\' && sep != '/') | 1280 | if (sep != '\\' && sep != '/') |
| 1257 | return -EINVAL; | 1281 | return -EINVAL; |
| 1258 | 1282 | ||
| 1259 | s = strchr(it->it_name + 1, sep); | 1283 | target_ppath = parse_target_share(it->it_name, &target_share); |
| 1260 | if (!s) | 1284 | if (IS_ERR(target_ppath)) |
| 1261 | return -EINVAL; | 1285 | return PTR_ERR(target_ppath); |
| 1262 | 1286 | ||
| 1263 | /* point to prefix in target node */ | 1287 | /* point to prefix in DFS referral path */ |
| 1264 | s = strchrnul(s + 1, sep); | 1288 | dfsref_ppath = path + it->it_path_consumed; |
| 1289 | dfsref_ppath += strspn(dfsref_ppath, "/\\"); | ||
| 1265 | 1290 | ||
| 1266 | /* extract target share */ | 1291 | target_pplen = strlen(target_ppath); |
| 1267 | *share = kstrndup(it->it_name, s - it->it_name, GFP_KERNEL); | 1292 | dfsref_pplen = strlen(dfsref_ppath); |
| 1268 | if (!*share) | ||
| 1269 | return -ENOMEM; | ||
| 1270 | 1293 | ||
| 1271 | /* skip separator */ | 1294 | /* merge prefix paths from DFS referral path and target node */ |
| 1272 | if (*s) | 1295 | if (target_pplen || dfsref_pplen) { |
| 1273 | s++; | 1296 | len = target_pplen + dfsref_pplen + 2; |
| 1274 | /* point to prefix in DFS path */ | 1297 | ppath = kzalloc(len, GFP_KERNEL); |
| 1275 | p = path + it->it_path_consumed; | 1298 | if (!ppath) { |
| 1276 | if (*p == sep) | 1299 | kfree(target_share); |
| 1277 | p++; | ||
| 1278 | |||
| 1279 | /* merge prefix paths from DFS path and target node */ | ||
| 1280 | plen1 = it->it_name + strlen(it->it_name) - s; | ||
| 1281 | plen2 = path + strlen(path) - p; | ||
| 1282 | if (plen1 || plen2) { | ||
| 1283 | len = plen1 + plen2 + 2; | ||
| 1284 | *prefix = kmalloc(len, GFP_KERNEL); | ||
| 1285 | if (!*prefix) { | ||
| 1286 | kfree(*share); | ||
| 1287 | *share = NULL; | ||
| 1288 | return -ENOMEM; | 1300 | return -ENOMEM; |
| 1289 | } | 1301 | } |
| 1290 | if (plen1) | 1302 | c = strscpy(ppath, target_ppath, len); |
| 1291 | scnprintf(*prefix, len, "%.*s%c%.*s", (int)plen1, s, sep, (int)plen2, p); | 1303 | if (c && dfsref_pplen) |
| 1292 | else | 1304 | ppath[c] = sep; |
| 1293 | strscpy(*prefix, p, len); | 1305 | strlcat(ppath, dfsref_ppath, len); |
| 1294 | } | 1306 | } |
| 1307 | *share = target_share; | ||
| 1308 | *prefix = ppath; | ||
| 1295 | return 0; | 1309 | return 0; |
| 1296 | } | 1310 | } |
| 1297 | 1311 | ||
| @@ -1327,9 +1341,9 @@ static bool target_share_equal(struct TCP_Server_Info *server, const char *s1, c · 29 unmodified lines | |||
| 1327 | cifs_dbg(VFS, "%s: failed to convert address \'%s\'. skip address matching.\n", | 1341 | cifs_dbg(VFS, "%s: failed to convert address \'%s\'. skip address matching.\n", |
| 1328 | __func__, ip); | 1342 | __func__, ip); |
| 1329 | } else { | 1343 | } else { |
| 1330 | mutex_lock(&server->srv_mutex); | 1344 | cifs_server_lock(server); |
| 1331 | match = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, &sa); | 1345 | match = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, &sa); |
| 1332 | mutex_unlock(&server->srv_mutex); | 1346 | cifs_server_unlock(server); |
| 1333 | } | 1347 | } |
| 1334 | 1348 | ||
| 1335 | kfree(ip); | 1349 | kfree(ip); |
| @@ -1120,14 +1120,14 @@ sess_establish_session(struct sess_data *sess_data) · 1119 unmodified lines | |||
| 1120 | struct cifs_ses *ses = sess_data->ses; | 1120 | struct cifs_ses *ses = sess_data->ses; |
| 1121 | struct TCP_Server_Info *server = sess_data->server; | 1121 | struct TCP_Server_Info *server = sess_data->server; |
| 1122 | 1122 | ||
| 1123 | mutex_lock(&server->srv_mutex); | 1123 | cifs_server_lock(server); |
| 1124 | if (!server->session_estab) { | 1124 | if (!server->session_estab) { |
| 1125 | if (server->sign) { | 1125 | if (server->sign) { |
| 1126 | server->session_key.response = | 1126 | server->session_key.response = |
| 1127 | kmemdup(ses->auth_key.response, | 1127 | kmemdup(ses->auth_key.response, |
| 1128 | ses->auth_key.len, GFP_KERNEL); | 1128 | ses->auth_key.len, GFP_KERNEL); |
| 1129 | if (!server->session_key.response) { | 1129 | if (!server->session_key.response) { |
| 1130 | mutex_unlock(&server->srv_mutex); | 1130 | cifs_server_unlock(server); |
| 1131 | return -ENOMEM; | 1131 | return -ENOMEM; |
| 1132 | } | 1132 | } |
| 1133 | server->session_key.len = | 1133 | server->session_key.len = |
| @@ -1136,7 +1136,7 @@ sess_establish_session(struct sess_data *sess_data) · 2 unmodified lines | |||
| 1136 | server->sequence_number = 0x2; | 1136 | server->sequence_number = 0x2; |
| 1137 | server->session_estab = true; | 1137 | server->session_estab = true; |
| 1138 | } | 1138 | } |
| 1139 | mutex_unlock(&server->srv_mutex); | 1139 | cifs_server_unlock(server); |
| 1140 | 1140 | ||
| 1141 | cifs_dbg(FYI, "CIFS session established successfully\n"); | 1141 | cifs_dbg(FYI, "CIFS session established successfully\n"); |
| 1142 | return 0; | 1142 | return 0; |
| @@ -38,10 +38,10 @@ send_nt_cancel(struct TCP_Server_Info *server, struct smb_rqst *rqst, · 37 unmodified lines | |||
| 38 | in_buf->WordCount = 0; | 38 | in_buf->WordCount = 0; |
| 39 | put_bcc(0, in_buf); | 39 | put_bcc(0, in_buf); |
| 40 | 40 | ||
| 41 | mutex_lock(&server->srv_mutex); | 41 | cifs_server_lock(server); |
| 42 | rc = cifs_sign_smb(in_buf, server, &mid->sequence_number); | 42 | rc = cifs_sign_smb(in_buf, server, &mid->sequence_number); |
| 43 | if (rc) { | 43 | if (rc) { |
| 44 | mutex_unlock(&server->srv_mutex); | 44 | cifs_server_unlock(server); |
| 45 | return rc; | 45 | return rc; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| @@ -55,7 +55,7 @@ send_nt_cancel(struct TCP_Server_Info *server, struct smb_rqst *rqst, · 7 unmodified lines | |||
| 55 | if (rc < 0) | 55 | if (rc < 0) |
| 56 | server->sequence_number--; | 56 | server->sequence_number--; |
| 57 | 57 | ||
| 58 | mutex_unlock(&server->srv_mutex); | 58 | cifs_server_unlock(server); |
| 59 | 59 | ||
| 60 | cifs_dbg(FYI, "issued NT_CANCEL for mid %u, rc = %d\n", | 60 | cifs_dbg(FYI, "issued NT_CANCEL for mid %u, rc = %d\n", |
| 61 | get_mid(in_buf), rc); | 61 | get_mid(in_buf), rc); |
| @@ -3859,7 +3859,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, · 3858 unmodified lines | |||
| 3859 | if (rc) | 3859 | if (rc) |
| 3860 | goto out; | 3860 | goto out; |
| 3861 | 3861 | ||
| 3862 | if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) | 3862 | if (cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) |
| 3863 | smb2_set_sparse(xid, tcon, cfile, inode, false); | 3863 | smb2_set_sparse(xid, tcon, cfile, inode, false); |
| 3864 | 3864 | ||
| 3865 | eof = cpu_to_le64(off + len); | 3865 | eof = cpu_to_le64(off + len); |
| @@ -4345,11 +4345,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, · 479 unmodified lines | |||
| 4345 | } | 4345 | } |
| 4346 | } | 4346 | } |
| 4347 | 4347 | ||
| 4348 | #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY | ||
| 4348 | static bool | 4349 | static bool |
| 4349 | smb2_is_read_op(__u32 oplock) | 4350 | smb2_is_read_op(__u32 oplock) |
| 4350 | { | 4351 | { |
| 4351 | return oplock == SMB2_OPLOCK_LEVEL_II; | 4352 | return oplock == SMB2_OPLOCK_LEVEL_II; |
| 4352 | } | 4353 | } |
| 4354 | #endif /* CIFS_ALLOW_INSECURE_LEGACY */ | ||
| 4353 | 4355 | ||
| 4354 | static bool | 4356 | static bool |
| 4355 | smb21_is_read_op(__u32 oplock) | 4357 | smb21_is_read_op(__u32 oplock) |
| @@ -5448,7 +5450,7 @@ out: · 1092 unmodified lines | |||
| 5448 | return rc; | 5450 | return rc; |
| 5449 | } | 5451 | } |
| 5450 | 5452 | ||
| 5451 | 5453 | #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY | |
| 5452 | struct smb_version_operations smb20_operations = { | 5454 | struct smb_version_operations smb20_operations = { |
| 5453 | .compare_fids = smb2_compare_fids, | 5455 | .compare_fids = smb2_compare_fids, |
| 5454 | .setup_request = smb2_setup_request, | 5456 | .setup_request = smb2_setup_request, |
| @@ -5547,6 +5549,7 @@ struct smb_version_operations smb20_operations = { · 92 unmodified lines | |||
| 5547 | .is_status_io_timeout = smb2_is_status_io_timeout, | 5549 | .is_status_io_timeout = smb2_is_status_io_timeout, |
| 5548 | .is_network_name_deleted = smb2_is_network_name_deleted, | 5550 | .is_network_name_deleted = smb2_is_network_name_deleted, |
| 5549 | }; | 5551 | }; |
| 5552 | #endif /* CIFS_ALLOW_INSECURE_LEGACY */ | ||
| 5550 | 5553 | ||
| 5551 | struct smb_version_operations smb21_operations = { | 5554 | struct smb_version_operations smb21_operations = { |
| 5552 | .compare_fids = smb2_compare_fids, | 5555 | .compare_fids = smb2_compare_fids, |
| @@ -5878,6 +5881,7 @@ struct smb_version_operations smb311_operations = { · 325 unmodified lines | |||
| 5878 | .is_network_name_deleted = smb2_is_network_name_deleted, | 5881 | .is_network_name_deleted = smb2_is_network_name_deleted, |
| 5879 | }; | 5882 | }; |
| 5880 | 5883 | ||
| 5884 | #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY | ||
| 5881 | struct smb_version_values smb20_values = { | 5885 | struct smb_version_values smb20_values = { |
| 5882 | .version_string = SMB20_VERSION_STRING, | 5886 | .version_string = SMB20_VERSION_STRING, |
| 5883 | .protocol_id = SMB20_PROT_ID, | 5887 | .protocol_id = SMB20_PROT_ID, |
| @@ -5898,6 +5902,7 @@ struct smb_version_values smb20_values = { · 14 unmodified lines | |||
| 5898 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | 5902 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, |
| 5899 | .create_lease_size = sizeof(struct create_lease), | 5903 | .create_lease_size = sizeof(struct create_lease), |
| 5900 | }; | 5904 | }; |
| 5905 | #endif /* ALLOW_INSECURE_LEGACY */ | ||
| 5901 | 5906 | ||
| 5902 | struct smb_version_values smb21_values = { | 5907 | struct smb_version_values smb21_values = { |
| 5903 | .version_string = SMB21_VERSION_STRING, | 5908 | .version_string = SMB21_VERSION_STRING, |
| @@ -1369,13 +1369,13 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data) · 1368 unmodified lines | |||
| 1369 | struct cifs_ses *ses = sess_data->ses; | 1369 | struct cifs_ses *ses = sess_data->ses; |
| 1370 | struct TCP_Server_Info *server = sess_data->server; | 1370 | struct TCP_Server_Info *server = sess_data->server; |
| 1371 | 1371 | ||
| 1372 | mutex_lock(&server->srv_mutex); | 1372 | cifs_server_lock(server); |
| 1373 | if (server->ops->generate_signingkey) { | 1373 | if (server->ops->generate_signingkey) { |
| 1374 | rc = server->ops->generate_signingkey(ses, server); | 1374 | rc = server->ops->generate_signingkey(ses, server); |
| 1375 | if (rc) { | 1375 | if (rc) { |
| 1376 | cifs_dbg(FYI, | 1376 | cifs_dbg(FYI, |
| 1377 | "SMB3 session key generation failed\n"); | 1377 | "SMB3 session key generation failed\n"); |
| 1378 | mutex_unlock(&server->srv_mutex); | 1378 | cifs_server_unlock(server); |
| 1379 | return rc; | 1379 | return rc; |
| 1380 | } | 1380 | } |
| 1381 | } | 1381 | } |
| @@ -1383,7 +1383,7 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data) · 1 unmodified line | |||
| 1383 | server->sequence_number = 0x2; | 1383 | server->sequence_number = 0x2; |
| 1384 | server->session_estab = true; | 1384 | server->session_estab = true; |
| 1385 | } | 1385 | } |
| 1386 | mutex_unlock(&server->srv_mutex); | 1386 | cifs_server_unlock(server); |
| 1387 | 1387 | ||
| 1388 | cifs_dbg(FYI, "SMB2/3 session established successfully\n"); | 1388 | cifs_dbg(FYI, "SMB2/3 session established successfully\n"); |
| 1389 | return rc; | 1389 | return rc; |
| @@ -1382,9 +1382,9 @@ void smbd_destroy(struct TCP_Server_Info *server) · 1381 unmodified lines | |||
| 1382 | log_rdma_event(INFO, "freeing mr list\n"); | 1382 | log_rdma_event(INFO, "freeing mr list\n"); |
| 1383 | wake_up_interruptible_all(&info->wait_mr); | 1383 | wake_up_interruptible_all(&info->wait_mr); |
| 1384 | while (atomic_read(&info->mr_used_count)) { | 1384 | while (atomic_read(&info->mr_used_count)) { |
| 1385 | mutex_unlock(&server->srv_mutex); | 1385 | cifs_server_unlock(server); |
| 1386 | msleep(1000); | 1386 | msleep(1000); |
| 1387 | mutex_lock(&server->srv_mutex); | 1387 | cifs_server_lock(server); |
| 1388 | } | 1388 | } |
| 1389 | destroy_mr_list(info); | 1389 | destroy_mr_list(info); |
| 1390 | 1390 | ||
| @@ -822,7 +822,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst, · 821 unmodified lines | |||
| 822 | } else | 822 | } else |
| 823 | instance = exist_credits->instance; | 823 | instance = exist_credits->instance; |
| 824 | 824 | ||
| 825 | mutex_lock(&server->srv_mutex); | 825 | cifs_server_lock(server); |
| 826 | 826 | ||
| 827 | /* | 827 | /* |
| 828 | * We can't use credits obtained from the previous session to send this | 828 | * We can't use credits obtained from the previous session to send this |
| @@ -830,14 +830,14 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst, · 1 unmodified line | |||
| 830 | * return -EAGAIN in such cases to let callers handle it. | 830 | * return -EAGAIN in such cases to let callers handle it. |
| 831 | */ | 831 | */ |
| 832 | if (instance != server->reconnect_instance) { | 832 | if (instance != server->reconnect_instance) { |
| 833 | mutex_unlock(&server->srv_mutex); | 833 | cifs_server_unlock(server); |
| 834 | add_credits_and_wake_if(server, &credits, optype); | 834 | add_credits_and_wake_if(server, &credits, optype); |
| 835 | return -EAGAIN; | 835 | return -EAGAIN; |
| 836 | } | 836 | } |
| 837 | 837 | ||
| 838 | mid = server->ops->setup_async_request(server, rqst); | 838 | mid = server->ops->setup_async_request(server, rqst); |
| 839 | if (IS_ERR(mid)) { | 839 | if (IS_ERR(mid)) { |
| 840 | mutex_unlock(&server->srv_mutex); | 840 | cifs_server_unlock(server); |
| 841 | add_credits_and_wake_if(server, &credits, optype); | 841 | add_credits_and_wake_if(server, &credits, optype); |
| 842 | return PTR_ERR(mid); | 842 | return PTR_ERR(mid); |
| 843 | } | 843 | } |
| @@ -868,7 +868,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst, · 24 unmodified lines | |||
| 868 | cifs_delete_mid(mid); | 868 | cifs_delete_mid(mid); |
| 869 | } | 869 | } |
| 870 | 870 | ||
| 871 | mutex_unlock(&server->srv_mutex); | 871 | cifs_server_unlock(server); |
| 872 | 872 | ||
| 873 | if (rc == 0) | 873 | if (rc == 0) |
| 874 | return 0; | 874 | return 0; |
| @@ -1109,7 +1109,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 234 unmodified lines | |||
| 1109 | * of smb data. | 1109 | * of smb data. |
| 1110 | */ | 1110 | */ |
| 1111 | 1111 | ||
| 1112 | mutex_lock(&server->srv_mutex); | 1112 | cifs_server_lock(server); |
| 1113 | 1113 | ||
| 1114 | /* | 1114 | /* |
| 1115 | * All the parts of the compound chain belong obtained credits from the | 1115 | * All the parts of the compound chain belong obtained credits from the |
| @@ -1119,7 +1119,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 3 unmodified lines | |||
| 1119 | * handle it. | 1119 | * handle it. |
| 1120 | */ | 1120 | */ |
| 1121 | if (instance != server->reconnect_instance) { | 1121 | if (instance != server->reconnect_instance) { |
| 1122 | mutex_unlock(&server->srv_mutex); | 1122 | cifs_server_unlock(server); |
| 1123 | for (j = 0; j < num_rqst; j++) | 1123 | for (j = 0; j < num_rqst; j++) |
| 1124 | add_credits(server, &credits[j], optype); | 1124 | add_credits(server, &credits[j], optype); |
| 1125 | return -EAGAIN; | 1125 | return -EAGAIN; |
| @@ -1131,7 +1131,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 5 unmodified lines | |||
| 1131 | revert_current_mid(server, i); | 1131 | revert_current_mid(server, i); |
| 1132 | for (j = 0; j < i; j++) | 1132 | for (j = 0; j < i; j++) |
| 1133 | cifs_delete_mid(midQ[j]); | 1133 | cifs_delete_mid(midQ[j]); |
| 1134 | mutex_unlock(&server->srv_mutex); | 1134 | cifs_server_unlock(server); |
| 1135 | 1135 | ||
| 1136 | /* Update # of requests on wire to server */ | 1136 | /* Update # of requests on wire to server */ |
| 1137 | for (j = 0; j < num_rqst; j++) | 1137 | for (j = 0; j < num_rqst; j++) |
| @@ -1163,7 +1163,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 25 unmodified lines | |||
| 1163 | server->sequence_number -= 2; | 1163 | server->sequence_number -= 2; |
| 1164 | } | 1164 | } |
| 1165 | 1165 | ||
| 1166 | mutex_unlock(&server->srv_mutex); | 1166 | cifs_server_unlock(server); |
| 1167 | 1167 | ||
| 1168 | /* | 1168 | /* |
| 1169 | * If sending failed for some reason or it is an oplock break that we | 1169 | * If sending failed for some reason or it is an oplock break that we |
| @@ -1190,9 +1190,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 20 unmodified lines | |||
| 1190 | if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) { | 1190 | if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) { |
| 1191 | spin_unlock(&cifs_tcp_ses_lock); | 1191 | spin_unlock(&cifs_tcp_ses_lock); |
| 1192 | 1192 | ||
| 1193 | mutex_lock(&server->srv_mutex); | 1193 | cifs_server_lock(server); |
| 1194 | smb311_update_preauth_hash(ses, server, rqst[0].rq_iov, rqst[0].rq_nvec); | 1194 | smb311_update_preauth_hash(ses, server, rqst[0].rq_iov, rqst[0].rq_nvec); |
| 1195 | mutex_unlock(&server->srv_mutex); | 1195 | cifs_server_unlock(server); |
| 1196 | 1196 | ||
| 1197 | spin_lock(&cifs_tcp_ses_lock); | 1197 | spin_lock(&cifs_tcp_ses_lock); |
| 1198 | } | 1198 | } |
| @@ -1266,9 +1266,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 67 unmodified lines | |||
| 1266 | .iov_len = resp_iov[0].iov_len | 1266 | .iov_len = resp_iov[0].iov_len |
| 1267 | }; | 1267 | }; |
| 1268 | spin_unlock(&cifs_tcp_ses_lock); | 1268 | spin_unlock(&cifs_tcp_ses_lock); |
| 1269 | mutex_lock(&server->srv_mutex); | 1269 | cifs_server_lock(server); |
| 1270 | smb311_update_preauth_hash(ses, server, &iov, 1); | 1270 | smb311_update_preauth_hash(ses, server, &iov, 1); |
| 1271 | mutex_unlock(&server->srv_mutex); | 1271 | cifs_server_unlock(server); |
| 1272 | spin_lock(&cifs_tcp_ses_lock); | 1272 | spin_lock(&cifs_tcp_ses_lock); |
| 1273 | } | 1273 | } |
| 1274 | spin_unlock(&cifs_tcp_ses_lock); | 1274 | spin_unlock(&cifs_tcp_ses_lock); |
| @@ -1385,11 +1385,11 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 110 unmodified lines | |||
| 1385 | and avoid races inside tcp sendmsg code that could cause corruption | 1385 | and avoid races inside tcp sendmsg code that could cause corruption |
| 1386 | of smb data */ | 1386 | of smb data */ |
| 1387 | 1387 | ||
| 1388 | mutex_lock(&server->srv_mutex); | 1388 | cifs_server_lock(server); |
| 1389 | 1389 | ||
| 1390 | rc = allocate_mid(ses, in_buf, &midQ); | 1390 | rc = allocate_mid(ses, in_buf, &midQ); |
| 1391 | if (rc) { | 1391 | if (rc) { |
| 1392 | mutex_unlock(&server->srv_mutex); | 1392 | cifs_server_unlock(server); |
| 1393 | /* Update # of requests on wire to server */ | 1393 | /* Update # of requests on wire to server */ |
| 1394 | add_credits(server, &credits, 0); | 1394 | add_credits(server, &credits, 0); |
| 1395 | return rc; | 1395 | return rc; |
| @@ -1397,7 +1397,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 1 unmodified line | |||
| 1397 | 1397 | ||
| 1398 | rc = cifs_sign_smb(in_buf, server, &midQ->sequence_number); | 1398 | rc = cifs_sign_smb(in_buf, server, &midQ->sequence_number); |
| 1399 | if (rc) { | 1399 | if (rc) { |
| 1400 | mutex_unlock(&server->srv_mutex); | 1400 | cifs_server_unlock(server); |
| 1401 | goto out; | 1401 | goto out; |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| @@ -1411,7 +1411,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 7 unmodified lines | |||
| 1411 | if (rc < 0) | 1411 | if (rc < 0) |
| 1412 | server->sequence_number -= 2; | 1412 | server->sequence_number -= 2; |
| 1413 | 1413 | ||
| 1414 | mutex_unlock(&server->srv_mutex); | 1414 | cifs_server_unlock(server); |
| 1415 | 1415 | ||
| 1416 | if (rc < 0) | 1416 | if (rc < 0) |
| 1417 | goto out; | 1417 | goto out; |
| @@ -1530,18 +1530,18 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 112 unmodified lines | |||
| 1530 | and avoid races inside tcp sendmsg code that could cause corruption | 1530 | and avoid races inside tcp sendmsg code that could cause corruption |
| 1531 | of smb data */ | 1531 | of smb data */ |
| 1532 | 1532 | ||
| 1533 | mutex_lock(&server->srv_mutex); | 1533 | cifs_server_lock(server); |
| 1534 | 1534 | ||
| 1535 | rc = allocate_mid(ses, in_buf, &midQ); | 1535 | rc = allocate_mid(ses, in_buf, &midQ); |
| 1536 | if (rc) { | 1536 | if (rc) { |
| 1537 | mutex_unlock(&server->srv_mutex); | 1537 | cifs_server_unlock(server); |
| 1538 | return rc; | 1538 | return rc; |
| 1539 | } | 1539 | } |
| 1540 | 1540 | ||
| 1541 | rc = cifs_sign_smb(in_buf, server, &midQ->sequence_number); | 1541 | rc = cifs_sign_smb(in_buf, server, &midQ->sequence_number); |
| 1542 | if (rc) { | 1542 | if (rc) { |
| 1543 | cifs_delete_mid(midQ); | 1543 | cifs_delete_mid(midQ); |
| 1544 | mutex_unlock(&server->srv_mutex); | 1544 | cifs_server_unlock(server); |
| 1545 | return rc; | 1545 | return rc; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| @@ -1554,7 +1554,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 6 unmodified lines | |||
| 1554 | if (rc < 0) | 1554 | if (rc < 0) |
| 1555 | server->sequence_number -= 2; | 1555 | server->sequence_number -= 2; |
| 1556 | 1556 | ||
| 1557 | mutex_unlock(&server->srv_mutex); | 1557 | cifs_server_unlock(server); |
| 1558 | 1558 | ||
| 1559 | if (rc < 0) { | 1559 | if (rc < 0) { |
| 1560 | cifs_delete_mid(midQ); | 1560 | cifs_delete_mid(midQ); |