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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"This ncludes various cifs/smb3 bug fixes, mostly for stable as well.

In the next week I expect that Germano will have some reconnection
fixes, and also I expect to have the remaining pieces of the snapshot
enablement and SMB3 ACLs, but wanted to get this set of bug fixes in"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
cifs_get_root shouldn't use path with tree name
Fix default behaviour for empty domains and add domainauto option
cifs: use %16phN for formatting md5 sum
cifs: Fix smbencrypt() to stop pointing a scatterlist at the stack
CIFS: Fix a possible double locking of mutex during reconnect
CIFS: Fix a possible memory corruption during reconnect
CIFS: Fix a possible memory corruption in push locks
CIFS: Fix missing nls unload in smb2_reconnect()
CIFS: Decrease verbosity of ioctl call
SMB3: parsing for new snapshot timestamp mount parm

+177 -90
+9 -5
fs/cifs/cifsencrypt.c
··· 699 699 700 700 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) { 701 701 if (!ses->domainName) { 702 - rc = find_domain_name(ses, nls_cp); 703 - if (rc) { 704 - cifs_dbg(VFS, "error %d finding domain name\n", 705 - rc); 706 - goto setup_ntlmv2_rsp_ret; 702 + if (ses->domainAuto) { 703 + rc = find_domain_name(ses, nls_cp); 704 + if (rc) { 705 + cifs_dbg(VFS, "error %d finding domain name\n", 706 + rc); 707 + goto setup_ntlmv2_rsp_ret; 708 + } 709 + } else { 710 + ses->domainName = kstrdup("", GFP_KERNEL); 707 711 } 708 712 } 709 713 } else {
+1 -1
fs/cifs/cifsfs.c
··· 615 615 return dget(sb->s_root); 616 616 617 617 full_path = cifs_build_path_to_root(vol, cifs_sb, 618 - cifs_sb_master_tcon(cifs_sb)); 618 + cifs_sb_master_tcon(cifs_sb), 0); 619 619 if (full_path == NULL) 620 620 return ERR_PTR(-ENOMEM); 621 621
+8
fs/cifs/cifsglob.h
··· 514 514 bool persistent:1; 515 515 bool nopersistent:1; 516 516 bool resilient:1; /* noresilient not required since not fored for CA */ 517 + bool domainauto:1; 517 518 unsigned int rsize; 518 519 unsigned int wsize; 519 520 bool sockopt_tcp_nodelay:1; ··· 526 525 struct sockaddr_storage srcaddr; /* allow binding to a local IP */ 527 526 struct nls_table *local_nls; 528 527 unsigned int echo_interval; /* echo interval in secs */ 528 + __u64 snapshot_time; /* needed for timewarp tokens */ 529 529 unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */ 530 530 }; 531 531 ··· 648 646 unsigned int max_read; 649 647 unsigned int max_write; 650 648 __u8 preauth_hash[512]; 649 + struct delayed_work reconnect; /* reconnect workqueue job */ 650 + struct mutex reconnect_mutex; /* prevent simultaneous reconnects */ 651 651 #endif /* CONFIG_CIFS_SMB2 */ 652 652 unsigned long echo_interval; 653 653 }; ··· 831 827 enum securityEnum sectype; /* what security flavor was specified? */ 832 828 bool sign; /* is signing required? */ 833 829 bool need_reconnect:1; /* connection reset, uid now invalid */ 830 + bool domainAuto:1; 834 831 #ifdef CONFIG_CIFS_SMB2 835 832 __u16 session_flags; 836 833 __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE]; ··· 854 849 struct cifs_tcon { 855 850 struct list_head tcon_list; 856 851 int tc_count; 852 + struct list_head rlist; /* reconnect list */ 857 853 struct list_head openFileList; 858 854 spinlock_t open_file_lock; /* protects list above */ 859 855 struct cifs_ses *ses; /* pointer to session associated with */ ··· 928 922 bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ 929 923 bool broken_sparse_sup; /* if server or share does not support sparse */ 930 924 bool need_reconnect:1; /* connection reset, tid now invalid */ 925 + bool need_reopen_files:1; /* need to reopen tcon file handles */ 931 926 bool use_resilient:1; /* use resilient instead of durable handles */ 932 927 bool use_persistent:1; /* use persistent instead of durable handles */ 933 928 #ifdef CONFIG_CIFS_SMB2 ··· 939 932 __u32 maximal_access; 940 933 __u32 vol_serial_number; 941 934 __le64 vol_create_time; 935 + __u64 snapshot_time; /* for timewarp tokens - timestamp of snapshot */ 942 936 __u32 ss_flags; /* sector size flags */ 943 937 __u32 perf_sector_size; /* best sector size for perf */ 944 938 __u32 max_chunks;
+5 -1
fs/cifs/cifsproto.h
··· 63 63 extern char *build_path_from_dentry(struct dentry *); 64 64 extern char *cifs_build_path_to_root(struct smb_vol *vol, 65 65 struct cifs_sb_info *cifs_sb, 66 - struct cifs_tcon *tcon); 66 + struct cifs_tcon *tcon, 67 + int add_treename); 67 68 extern char *build_wildcard_path_from_dentry(struct dentry *direntry); 68 69 extern char *cifs_compose_mount_options(const char *sb_mountdata, 69 70 const char *fullpath, const struct dfs_info3_param *ref, ··· 207 206 struct tcon_link *tlink, 208 207 struct cifs_pending_open *open); 209 208 extern void cifs_del_pending_open(struct cifs_pending_open *open); 209 + extern void cifs_put_tcp_session(struct TCP_Server_Info *server, 210 + int from_reconnect); 211 + extern void cifs_put_tcon(struct cifs_tcon *tcon); 210 212 211 213 #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) 212 214 extern void cifs_dfs_release_automount_timer(void);
+71 -11
fs/cifs/connect.c
··· 53 53 #include "nterr.h" 54 54 #include "rfc1002pdu.h" 55 55 #include "fscache.h" 56 + #ifdef CONFIG_CIFS_SMB2 57 + #include "smb2proto.h" 58 + #endif 56 59 57 60 #define CIFS_PORT 445 58 61 #define RFC1001_PORT 139 ··· 92 89 Opt_multiuser, Opt_sloppy, Opt_nosharesock, 93 90 Opt_persistent, Opt_nopersistent, 94 91 Opt_resilient, Opt_noresilient, 92 + Opt_domainauto, 95 93 96 94 /* Mount options which take numeric value */ 97 95 Opt_backupuid, Opt_backupgid, Opt_uid, ··· 100 96 Opt_dirmode, Opt_port, 101 97 Opt_rsize, Opt_wsize, Opt_actimeo, 102 98 Opt_echo_interval, Opt_max_credits, 99 + Opt_snapshot, 103 100 104 101 /* Mount options which take string value */ 105 102 Opt_user, Opt_pass, Opt_ip, ··· 182 177 { Opt_nopersistent, "nopersistenthandles"}, 183 178 { Opt_resilient, "resilienthandles"}, 184 179 { Opt_noresilient, "noresilienthandles"}, 180 + { Opt_domainauto, "domainauto"}, 185 181 186 182 { Opt_backupuid, "backupuid=%s" }, 187 183 { Opt_backupgid, "backupgid=%s" }, ··· 198 192 { Opt_actimeo, "actimeo=%s" }, 199 193 { Opt_echo_interval, "echo_interval=%s" }, 200 194 { Opt_max_credits, "max_credits=%s" }, 195 + { Opt_snapshot, "snapshot=%s" }, 201 196 202 197 { Opt_blank_user, "user=" }, 203 198 { Opt_blank_user, "username=" }, ··· 1507 1500 case Opt_noresilient: 1508 1501 vol->resilient = false; /* already the default */ 1509 1502 break; 1503 + case Opt_domainauto: 1504 + vol->domainauto = true; 1505 + break; 1510 1506 1511 1507 /* Numeric Values */ 1512 1508 case Opt_backupuid: ··· 1611 1601 goto cifs_parse_mount_err; 1612 1602 } 1613 1603 vol->echo_interval = option; 1604 + break; 1605 + case Opt_snapshot: 1606 + if (get_option_ul(args, &option)) { 1607 + cifs_dbg(VFS, "%s: Invalid snapshot time\n", 1608 + __func__); 1609 + goto cifs_parse_mount_err; 1610 + } 1611 + vol->snapshot_time = option; 1614 1612 break; 1615 1613 case Opt_max_credits: 1616 1614 if (get_option_ul(args, &option) || (option < 20) || ··· 2119 2101 return NULL; 2120 2102 } 2121 2103 2122 - static void 2123 - cifs_put_tcp_session(struct TCP_Server_Info *server) 2104 + void 2105 + cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) 2124 2106 { 2125 2107 struct task_struct *task; 2126 2108 ··· 2136 2118 spin_unlock(&cifs_tcp_ses_lock); 2137 2119 2138 2120 cancel_delayed_work_sync(&server->echo); 2121 + 2122 + #ifdef CONFIG_CIFS_SMB2 2123 + if (from_reconnect) 2124 + /* 2125 + * Avoid deadlock here: reconnect work calls 2126 + * cifs_put_tcp_session() at its end. Need to be sure 2127 + * that reconnect work does nothing with server pointer after 2128 + * that step. 2129 + */ 2130 + cancel_delayed_work(&server->reconnect); 2131 + else 2132 + cancel_delayed_work_sync(&server->reconnect); 2133 + #endif 2139 2134 2140 2135 spin_lock(&GlobalMid_Lock); 2141 2136 server->tcpStatus = CifsExiting; ··· 2214 2183 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); 2215 2184 INIT_LIST_HEAD(&tcp_ses->smb_ses_list); 2216 2185 INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); 2186 + #ifdef CONFIG_CIFS_SMB2 2187 + INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server); 2188 + mutex_init(&tcp_ses->reconnect_mutex); 2189 + #endif 2217 2190 memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr, 2218 2191 sizeof(tcp_ses->srcaddr)); 2219 2192 memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr, ··· 2376 2341 spin_unlock(&cifs_tcp_ses_lock); 2377 2342 2378 2343 sesInfoFree(ses); 2379 - cifs_put_tcp_session(server); 2344 + cifs_put_tcp_session(server, 0); 2380 2345 } 2381 2346 2382 2347 #ifdef CONFIG_KEYS ··· 2550 2515 mutex_unlock(&ses->session_mutex); 2551 2516 2552 2517 /* existing SMB ses has a server reference already */ 2553 - cifs_put_tcp_session(server); 2518 + cifs_put_tcp_session(server, 0); 2554 2519 free_xid(xid); 2555 2520 return ses; 2556 2521 } ··· 2584 2549 if (!ses->domainName) 2585 2550 goto get_ses_fail; 2586 2551 } 2552 + if (volume_info->domainauto) 2553 + ses->domainAuto = volume_info->domainauto; 2587 2554 ses->cred_uid = volume_info->cred_uid; 2588 2555 ses->linux_uid = volume_info->linux_uid; 2589 2556 ··· 2624 2587 } 2625 2588 2626 2589 static struct cifs_tcon * 2627 - cifs_find_tcon(struct cifs_ses *ses, const char *unc) 2590 + cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) 2628 2591 { 2629 2592 struct list_head *tmp; 2630 2593 struct cifs_tcon *tcon; ··· 2632 2595 spin_lock(&cifs_tcp_ses_lock); 2633 2596 list_for_each(tmp, &ses->tcon_list) { 2634 2597 tcon = list_entry(tmp, struct cifs_tcon, tcon_list); 2635 - if (!match_tcon(tcon, unc)) 2598 + if (!match_tcon(tcon, volume_info->UNC)) 2636 2599 continue; 2600 + 2601 + #ifdef CONFIG_CIFS_SMB2 2602 + if (tcon->snapshot_time != volume_info->snapshot_time) 2603 + continue; 2604 + #endif /* CONFIG_CIFS_SMB2 */ 2605 + 2637 2606 ++tcon->tc_count; 2638 2607 spin_unlock(&cifs_tcp_ses_lock); 2639 2608 return tcon; ··· 2648 2605 return NULL; 2649 2606 } 2650 2607 2651 - static void 2608 + void 2652 2609 cifs_put_tcon(struct cifs_tcon *tcon) 2653 2610 { 2654 2611 unsigned int xid; ··· 2680 2637 int rc, xid; 2681 2638 struct cifs_tcon *tcon; 2682 2639 2683 - tcon = cifs_find_tcon(ses, volume_info->UNC); 2640 + tcon = cifs_find_tcon(ses, volume_info); 2684 2641 if (tcon) { 2685 2642 cifs_dbg(FYI, "Found match on UNC path\n"); 2686 2643 /* existing tcon already has a reference */ ··· 2699 2656 if (tcon == NULL) { 2700 2657 rc = -ENOMEM; 2701 2658 goto out_fail; 2659 + } 2660 + 2661 + if (volume_info->snapshot_time) { 2662 + #ifdef CONFIG_CIFS_SMB2 2663 + if (ses->server->vals->protocol_id == 0) { 2664 + cifs_dbg(VFS, 2665 + "Use SMB2 or later for snapshot mount option\n"); 2666 + rc = -EOPNOTSUPP; 2667 + goto out_fail; 2668 + } else 2669 + tcon->snapshot_time = volume_info->snapshot_time; 2670 + #else 2671 + cifs_dbg(VFS, "Snapshot mount option requires SMB2 support\n"); 2672 + rc = -EOPNOTSUPP; 2673 + goto out_fail; 2674 + #endif /* CONFIG_CIFS_SMB2 */ 2702 2675 } 2703 2676 2704 2677 tcon->ses = ses; ··· 3766 3707 /* 3767 3708 * cifs_build_path_to_root works only when we have a valid tcon 3768 3709 */ 3769 - full_path = cifs_build_path_to_root(volume_info, cifs_sb, tcon); 3710 + full_path = cifs_build_path_to_root(volume_info, cifs_sb, tcon, 3711 + tcon->Flags & SMB_SHARE_IS_IN_DFS); 3770 3712 if (full_path == NULL) { 3771 3713 rc = -ENOMEM; 3772 3714 goto mount_fail_check; ··· 3853 3793 else if (ses) 3854 3794 cifs_put_smb_ses(ses); 3855 3795 else 3856 - cifs_put_tcp_session(server); 3796 + cifs_put_tcp_session(server, 0); 3857 3797 bdi_destroy(&cifs_sb->bdi); 3858 3798 } 3859 3799 ··· 4164 4104 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info); 4165 4105 if (IS_ERR(ses)) { 4166 4106 tcon = (struct cifs_tcon *)ses; 4167 - cifs_put_tcp_session(master_tcon->ses->server); 4107 + cifs_put_tcp_session(master_tcon->ses->server, 0); 4168 4108 goto out; 4169 4109 } 4170 4110
+2 -2
fs/cifs/dir.c
··· 47 47 48 48 char * 49 49 cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, 50 - struct cifs_tcon *tcon) 50 + struct cifs_tcon *tcon, int add_treename) 51 51 { 52 52 int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0; 53 53 int dfsplen; ··· 59 59 return full_path; 60 60 } 61 61 62 - if (tcon->Flags & SMB_SHARE_IS_IN_DFS) 62 + if (add_treename) 63 63 dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); 64 64 else 65 65 dfsplen = 0;
+7 -1
fs/cifs/file.c
··· 777 777 struct list_head *tmp1; 778 778 struct list_head tmp_list; 779 779 780 + if (!tcon->use_persistent || !tcon->need_reopen_files) 781 + return; 782 + 783 + tcon->need_reopen_files = false; 784 + 780 785 cifs_dbg(FYI, "Reopen persistent handles"); 781 786 INIT_LIST_HEAD(&tmp_list); 782 787 ··· 798 793 799 794 list_for_each_safe(tmp, tmp1, &tmp_list) { 800 795 open_file = list_entry(tmp, struct cifsFileInfo, rlist); 801 - cifs_reopen_file(open_file, false /* do not flush */); 796 + if (cifs_reopen_file(open_file, false /* do not flush */)) 797 + tcon->need_reopen_files = true; 802 798 list_del_init(&open_file->rlist); 803 799 cifsFileInfo_put(open_file); 804 800 }
+1 -1
fs/cifs/ioctl.c
··· 189 189 xid = get_xid(); 190 190 191 191 cifs_sb = CIFS_SB(inode->i_sb); 192 - cifs_dbg(VFS, "cifs ioctl 0x%x\n", command); 192 + cifs_dbg(FYI, "cifs ioctl 0x%x\n", command); 193 193 switch (command) { 194 194 case FS_IOC_GETFLAGS: 195 195 if (pSMBFile == NULL)
+2 -7
fs/cifs/link.c
··· 45 45 (CIFS_MF_SYMLINK_LINK_OFFSET + CIFS_MF_SYMLINK_LINK_MAXLEN) 46 46 47 47 #define CIFS_MF_SYMLINK_LEN_FORMAT "XSym\n%04u\n" 48 - #define CIFS_MF_SYMLINK_MD5_FORMAT \ 49 - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n" 50 - #define CIFS_MF_SYMLINK_MD5_ARGS(md5_hash) \ 51 - md5_hash[0], md5_hash[1], md5_hash[2], md5_hash[3], \ 52 - md5_hash[4], md5_hash[5], md5_hash[6], md5_hash[7], \ 53 - md5_hash[8], md5_hash[9], md5_hash[10], md5_hash[11],\ 54 - md5_hash[12], md5_hash[13], md5_hash[14], md5_hash[15] 48 + #define CIFS_MF_SYMLINK_MD5_FORMAT "%16phN\n" 49 + #define CIFS_MF_SYMLINK_MD5_ARGS(md5_hash) md5_hash 55 50 56 51 static int 57 52 symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash)
+1 -1
fs/cifs/smb2file.c
··· 260 260 * and check it for zero before using. 261 261 */ 262 262 max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf; 263 - if (!max_buf) { 263 + if (max_buf < sizeof(struct smb2_lock_element)) { 264 264 free_xid(xid); 265 265 return -EINVAL; 266 266 }
+59 -28
fs/cifs/smb2pdu.c
··· 250 250 } 251 251 252 252 cifs_mark_open_files_invalid(tcon); 253 + if (tcon->use_persistent) 254 + tcon->need_reopen_files = true; 253 255 254 256 rc = SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nls_codepage); 255 257 mutex_unlock(&tcon->ses->session_mutex); 256 258 257 - if (tcon->use_persistent) 258 - cifs_reopen_persistent_handles(tcon); 259 - 260 259 cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc); 261 260 if (rc) 262 261 goto out; 262 + 263 + if (smb2_command != SMB2_INTERNAL_CMD) 264 + queue_delayed_work(cifsiod_wq, &server->reconnect, 0); 265 + 263 266 atomic_inc(&tconInfoReconnectCount); 264 267 out: 265 268 /* ··· 283 280 case SMB2_CHANGE_NOTIFY: 284 281 case SMB2_QUERY_INFO: 285 282 case SMB2_SET_INFO: 286 - return -EAGAIN; 283 + rc = -EAGAIN; 287 284 } 288 285 unload_nls(nls_codepage); 289 286 return rc; ··· 1975 1972 add_credits(server, credits_received, CIFS_ECHO_OP); 1976 1973 } 1977 1974 1975 + void smb2_reconnect_server(struct work_struct *work) 1976 + { 1977 + struct TCP_Server_Info *server = container_of(work, 1978 + struct TCP_Server_Info, reconnect.work); 1979 + struct cifs_ses *ses; 1980 + struct cifs_tcon *tcon, *tcon2; 1981 + struct list_head tmp_list; 1982 + int tcon_exist = false; 1983 + 1984 + /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */ 1985 + mutex_lock(&server->reconnect_mutex); 1986 + 1987 + INIT_LIST_HEAD(&tmp_list); 1988 + cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n"); 1989 + 1990 + spin_lock(&cifs_tcp_ses_lock); 1991 + list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 1992 + list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 1993 + if (tcon->need_reconnect || tcon->need_reopen_files) { 1994 + tcon->tc_count++; 1995 + list_add_tail(&tcon->rlist, &tmp_list); 1996 + tcon_exist = true; 1997 + } 1998 + } 1999 + } 2000 + /* 2001 + * Get the reference to server struct to be sure that the last call of 2002 + * cifs_put_tcon() in the loop below won't release the server pointer. 2003 + */ 2004 + if (tcon_exist) 2005 + server->srv_count++; 2006 + 2007 + spin_unlock(&cifs_tcp_ses_lock); 2008 + 2009 + list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) { 2010 + if (!smb2_reconnect(SMB2_INTERNAL_CMD, tcon)) 2011 + cifs_reopen_persistent_handles(tcon); 2012 + list_del_init(&tcon->rlist); 2013 + cifs_put_tcon(tcon); 2014 + } 2015 + 2016 + cifs_dbg(FYI, "Reconnecting tcons finished\n"); 2017 + mutex_unlock(&server->reconnect_mutex); 2018 + 2019 + /* now we can safely release srv struct */ 2020 + if (tcon_exist) 2021 + cifs_put_tcp_session(server, 1); 2022 + } 2023 + 1978 2024 int 1979 2025 SMB2_echo(struct TCP_Server_Info *server) 1980 2026 { ··· 2036 1984 cifs_dbg(FYI, "In echo request\n"); 2037 1985 2038 1986 if (server->tcpStatus == CifsNeedNegotiate) { 2039 - struct list_head *tmp, *tmp2; 2040 - struct cifs_ses *ses; 2041 - struct cifs_tcon *tcon; 2042 - 2043 - cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n"); 2044 - spin_lock(&cifs_tcp_ses_lock); 2045 - list_for_each(tmp, &server->smb_ses_list) { 2046 - ses = list_entry(tmp, struct cifs_ses, smb_ses_list); 2047 - list_for_each(tmp2, &ses->tcon_list) { 2048 - tcon = list_entry(tmp2, struct cifs_tcon, 2049 - tcon_list); 2050 - /* add check for persistent handle reconnect */ 2051 - if (tcon && tcon->need_reconnect) { 2052 - spin_unlock(&cifs_tcp_ses_lock); 2053 - rc = smb2_reconnect(SMB2_ECHO, tcon); 2054 - spin_lock(&cifs_tcp_ses_lock); 2055 - } 2056 - } 2057 - } 2058 - spin_unlock(&cifs_tcp_ses_lock); 1987 + /* No need to send echo on newly established connections */ 1988 + queue_delayed_work(cifsiod_wq, &server->reconnect, 0); 1989 + return rc; 2059 1990 } 2060 - 2061 - /* if no session, renegotiate failed above */ 2062 - if (server->tcpStatus == CifsNeedNegotiate) 2063 - return -EIO; 2064 1991 2065 1992 rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); 2066 1993 if (rc)
+2
fs/cifs/smb2pdu.h
··· 80 80 #define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE) 81 81 #define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE) 82 82 83 + #define SMB2_INTERNAL_CMD cpu_to_le16(0xFFFF) 84 + 83 85 #define NUMBER_OF_SMB2_COMMANDS 0x0013 84 86 85 87 /* BB FIXME - analyze following length BB */
+1
fs/cifs/smb2proto.h
··· 96 96 extern int smb2_unlock_range(struct cifsFileInfo *cfile, 97 97 struct file_lock *flock, const unsigned int xid); 98 98 extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile); 99 + extern void smb2_reconnect_server(struct work_struct *work); 99 100 100 101 /* 101 102 * SMB2 Worker functions - most of protocol specific implementation details
+8 -32
fs/cifs/smbencrypt.c
··· 23 23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 24 */ 25 25 26 - #include <crypto/skcipher.h> 26 + #include <linux/crypto.h> 27 27 #include <linux/module.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/fs.h> ··· 69 69 static int 70 70 smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) 71 71 { 72 - int rc; 73 72 unsigned char key2[8]; 74 - struct crypto_skcipher *tfm_des; 75 - struct scatterlist sgin, sgout; 76 - struct skcipher_request *req; 73 + struct crypto_cipher *tfm_des; 77 74 78 75 str_to_key(key, key2); 79 76 80 - tfm_des = crypto_alloc_skcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC); 77 + tfm_des = crypto_alloc_cipher("des", 0, 0); 81 78 if (IS_ERR(tfm_des)) { 82 - rc = PTR_ERR(tfm_des); 83 79 cifs_dbg(VFS, "could not allocate des crypto API\n"); 84 - goto smbhash_err; 80 + return PTR_ERR(tfm_des); 85 81 } 86 82 87 - req = skcipher_request_alloc(tfm_des, GFP_KERNEL); 88 - if (!req) { 89 - rc = -ENOMEM; 90 - cifs_dbg(VFS, "could not allocate des crypto API\n"); 91 - goto smbhash_free_skcipher; 92 - } 83 + crypto_cipher_setkey(tfm_des, key2, 8); 84 + crypto_cipher_encrypt_one(tfm_des, out, in); 85 + crypto_free_cipher(tfm_des); 93 86 94 - crypto_skcipher_setkey(tfm_des, key2, 8); 95 - 96 - sg_init_one(&sgin, in, 8); 97 - sg_init_one(&sgout, out, 8); 98 - 99 - skcipher_request_set_callback(req, 0, NULL, NULL); 100 - skcipher_request_set_crypt(req, &sgin, &sgout, 8, NULL); 101 - 102 - rc = crypto_skcipher_encrypt(req); 103 - if (rc) 104 - cifs_dbg(VFS, "could not encrypt crypt key rc: %d\n", rc); 105 - 106 - skcipher_request_free(req); 107 - 108 - smbhash_free_skcipher: 109 - crypto_free_skcipher(tfm_des); 110 - smbhash_err: 111 - return rc; 87 + return 0; 112 88 } 113 89 114 90 static int