diff options
author | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-12 12:38:47 -0300 |
---|---|---|
committer | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-12 12:51:58 -0300 |
commit | 100110d6d4a08752ed3cfb871540d96a225aa0fa (patch) | |
tree | 99ad522c69bc5e3ee4c9d37bb4f71f2a86511f98 | |
parent | 829e308a87028b434ffe0b38350de2d8d9a1705b (diff) | |
download | linux-100110d6d4a08752ed3cfb871540d96a225aa0fa.tar.gz linux-100110d6d4a08752ed3cfb871540d96a225aa0fa.tar.bz2 linux-100110d6d4a08752ed3cfb871540d96a225aa0fa.zip |
smb: client: remove support for SMB 1.0 and 2.0 mounts
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
-rw-r--r-- | fs/smb/client/cached_dir.c | 3 | ||||
-rw-r--r-- | fs/smb/client/cifsencrypt.c | 13 | ||||
-rw-r--r-- | fs/smb/client/cifsfs.c | 65 | ||||
-rw-r--r-- | fs/smb/client/cifsglob.h | 30 | ||||
-rw-r--r-- | fs/smb/client/connect.c | 27 | ||||
-rw-r--r-- | fs/smb/client/fs_context.c | 23 | ||||
-rw-r--r-- | fs/smb/client/fs_context.h | 4 | ||||
-rw-r--r-- | fs/smb/client/inode.c | 4 | ||||
-rw-r--r-- | fs/smb/client/smb2pdu.c | 55 | ||||
-rw-r--r-- | fs/smb/client/transport.c | 26 |
10 files changed, 82 insertions, 168 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 0ff2491c311d..a4c3cad35c41 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -147,8 +147,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, const char *npath; int retries = 0, cur_sleep = 1; - if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || - is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0)) + if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || dir_cache_timeout == 0) return -EOPNOTSUPP; ses = tcon->ses; diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c index b0473c2567fe..72d4c2bf3fcd 100644 --- a/fs/smb/client/cifsencrypt.c +++ b/fs/smb/client/cifsencrypt.c @@ -178,15 +178,10 @@ int __cifs_calc_signature(struct smb_rqst *rqst, int n_vec = rqst->rq_nvec; /* iov[0] is actual data and not the rfc1002 length for SMB2+ */ - if (!is_smb1(server)) { - if (iov[0].iov_len <= 4) - return -EIO; - i = 0; - } else { - if (n_vec < 2 || iov[0].iov_len != 4) - return -EIO; - i = 1; /* skip rfc1002 length */ - } + if (iov[0].iov_len <= 4) + return -EIO; + + i = 0; for (; i < n_vec; i++) { if (iov[i].iov_len == 0) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 9bdb6e7f1dc3..49e2e2bf45e6 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -64,7 +64,6 @@ bool traceSMB; bool enable_oplocks = true; bool linuxExtEnabled = true; bool lookupCacheEnabled = true; -bool disable_legacy_dialects; /* false by default */ bool enable_gcm_256 = true; bool require_gcm_256; /* false by default */ bool enable_negotiate_signing; /* false by default */ @@ -113,11 +112,10 @@ unsigned int cifs_min_small = 30; module_param(cifs_min_small, uint, 0444); MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 " "Range: 2 to 256"); -unsigned int cifs_max_pending = CIFS_MAX_REQ; +static unsigned int cifs_max_pending; module_param(cifs_max_pending, uint, 0444); -MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server for " - "CIFS/SMB1 dialect (N/A for SMB3) " - "Default: 32767 Range: 2 to 32767."); +MODULE_PARM_DESC(cifs_max_pending, "(deprecated) SMB 1.0 is no longer supported."); + unsigned int dir_cache_timeout = 30; module_param(dir_cache_timeout, uint, 0644); MODULE_PARM_DESC(dir_cache_timeout, "Number of seconds to cache directory contents for which we have a lease. Default: 30 " @@ -142,14 +140,12 @@ MODULE_PARM_DESC(require_gcm_256, "Require strongest (256 bit) GCM encryption. D module_param(enable_negotiate_signing, bool, 0644); MODULE_PARM_DESC(enable_negotiate_signing, "Enable negotiating packet signing algorithm with server. Default: n/N/0"); -module_param(disable_legacy_dialects, bool, 0644); -MODULE_PARM_DESC(disable_legacy_dialects, "To improve security it may be " - "helpful to restrict the ability to " - "override the default dialects (SMB2.1, " - "SMB3 and SMB3.02) on mount with old " - "dialects (CIFS/SMB1 and SMB2) since " - "vers=1.0 (CIFS/SMB1) and vers=2.0 are weaker" - " and less secure. Default: n/N/0"); +/* + * TODO(deprecated): remove this + */ +static bool disable_legacy_dialects; +module_param(disable_legacy_dialects, bool, 0444); +MODULE_PARM_DESC(disable_legacy_dialects, "(deprecated) SMB 1.0 and 2.0 are no longer supported."); struct workqueue_struct *cifsiod_wq; struct workqueue_struct *decrypt_wq; @@ -207,34 +203,14 @@ cifs_read_super(struct super_block *sb) sb->s_maxbytes = MAX_NON_LFS; /* - * Some very old servers like DOS and OS/2 used 2 second granularity - * (while all current servers use 100ns granularity - see MS-DTYP) - * but 1 second is the maximum allowed granularity for the VFS - * so for old servers set time granularity to 1 second while for - * everything else (current servers) set it to 100ns. + * Almost every server, including all SMB2+, uses DCE TIME + * ie 100 nanosecond units, since 1601. See MS-DTYP and MS-FSCC */ - if ((tcon->ses->server->vals->protocol_id == SMB10_PROT_ID) && - ((tcon->ses->capabilities & - tcon->ses->server->vals->cap_nt_find) == 0) && - !tcon->unix_ext) { - sb->s_time_gran = 1000000000; /* 1 second is max allowed gran */ - ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MIN), 0, 0); - sb->s_time_min = ts.tv_sec; - ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MAX), - cpu_to_le16(SMB_TIME_MAX), 0); - sb->s_time_max = ts.tv_sec; - } else { - /* - * Almost every server, including all SMB2+, uses DCE TIME - * ie 100 nanosecond units, since 1601. See MS-DTYP and MS-FSCC - */ - sb->s_time_gran = 100; - ts = cifs_NTtimeToUnix(0); - sb->s_time_min = ts.tv_sec; - ts = cifs_NTtimeToUnix(cpu_to_le64(S64_MAX)); - sb->s_time_max = ts.tv_sec; - } - + sb->s_time_gran = 100; + ts = cifs_NTtimeToUnix(0); + sb->s_time_min = ts.tv_sec; + ts = cifs_NTtimeToUnix(cpu_to_le64(S64_MAX)); + sb->s_time_max = ts.tv_sec; sb->s_magic = CIFS_SUPER_MAGIC; sb->s_op = &cifs_super_ops; sb->s_xattr = cifs_xattr_handlers; @@ -1832,15 +1808,6 @@ init_cifs(void) cifs_lock_secret = get_random_u32(); - if (cifs_max_pending < 2) { - cifs_max_pending = 2; - cifs_dbg(FYI, "cifs_max_pending set to min of 2\n"); - } else if (cifs_max_pending > CIFS_MAX_REQ) { - cifs_max_pending = CIFS_MAX_REQ; - cifs_dbg(FYI, "cifs_max_pending set to max of %u\n", - CIFS_MAX_REQ); - } - /* Limit max to about 18 hours, and setting to zero disables directory entry caching */ if (dir_cache_timeout > 65000) { dir_cache_timeout = 65000; diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 9a966556ee5d..ec7e911788f4 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -823,11 +823,6 @@ struct TCP_Server_Info { char *leaf_fullpath; }; -static inline bool is_smb1(struct TCP_Server_Info *server) -{ - return HEADER_PREAMBLE_SIZE(server) != 0; -} - static inline void cifs_server_lock(struct TCP_Server_Info *server) { unsigned int nofs_flag = memalloc_nofs_save(); @@ -2054,9 +2049,7 @@ extern bool linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/ extern unsigned int CIFSMaxBufSize; /* max size not including hdr */ extern unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ extern unsigned int cifs_min_small; /* min size of small buf pool */ -extern unsigned int cifs_max_pending; /* MAX requests at once to server*/ extern unsigned int dir_cache_timeout; /* max time for directory lease caching of dir */ -extern bool disable_legacy_dialects; /* forbid vers=1.0 and vers=2.0 mounts */ extern atomic_t mid_count; void cifs_oplock_break(struct work_struct *work); @@ -2079,8 +2072,6 @@ extern mempool_t cifs_io_request_pool; extern mempool_t cifs_io_subrequest_pool; /* Operations for different SMB versions */ -#define SMB1_VERSION_STRING "1.0" -#define SMB20_VERSION_STRING "2.0" #define SMB21_VERSION_STRING "2.1" extern struct smb_version_operations smb21_operations; extern struct smb_version_values smb21_values; @@ -2114,24 +2105,16 @@ static inline char *get_security_type_str(enum securityEnum sectype) } } -static inline bool is_smb1_server(struct TCP_Server_Info *server) -{ - return strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0; -} - static inline bool is_tcon_dfs(struct cifs_tcon *tcon) { /* - * For SMB1, see MS-CIFS 2.4.55 SMB_COM_TREE_CONNECT_ANDX (0x75) and MS-CIFS 3.3.4.4 DFS - * Subsystem Notifies That a Share Is a DFS Share. - * - * For SMB2+, see MS-SMB2 2.2.10 SMB2 TREE_CONNECT Response and MS-SMB2 3.3.4.14 Server + * See MS-SMB2 2.2.10 SMB2 TREE_CONNECT Response and MS-SMB2 3.3.4.14 Server * Application Updates a Share. */ if (!tcon || !tcon->ses || !tcon->ses->server) return false; - return is_smb1_server(tcon->ses->server) ? tcon->Flags & SMB_SHARE_IS_IN_DFS : - tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT); + + return (tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT)); } static inline bool cifs_is_referral_server(struct cifs_tcon *tcon, @@ -2153,12 +2136,7 @@ static inline size_t ntlmssp_workstation_name_size(const struct cifs_ses *ses) { if (WARN_ON_ONCE(!ses || !ses->server)) return 0; - /* - * Make workstation name no more than 15 chars when using insecure dialects as some legacy - * servers do require it during NTLMSSP. - */ - if (ses->server->dialect <= SMB20_PROT_ID) - return min_t(size_t, sizeof(ses->workstation_name), RFC1001_NAME_LEN_WITH_NULL); + return sizeof(ses->workstation_name); } diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index baafe575d310..65edce63efef 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -893,12 +893,6 @@ smb2_get_credits_from_hdr(char *buffer, struct TCP_Server_Info *server) { struct smb2_hdr *shdr = (struct smb2_hdr *)buffer; - /* - * SMB1 does not use credits. - */ - if (is_smb1(server)) - return 0; - return le16_to_cpu(shdr->CreditRequest); } @@ -1139,12 +1133,6 @@ smb2_add_credits_from_hdr(char *buffer, struct TCP_Server_Info *server) struct smb2_hdr *shdr = (struct smb2_hdr *)buffer; int scredits, in_flight; - /* - * SMB1 does not use credits. - */ - if (is_smb1(server)) - return; - if (shdr->CreditRequest) { spin_lock(&server->req_lock); server->credits += le16_to_cpu(shdr->CreditRequest); @@ -1201,10 +1189,7 @@ cifs_demultiplex_thread(void *p) if (length < 0) continue; - if (is_smb1(server)) - server->total_read = length; - else - server->total_read = 0; + server->total_read = 0; /* * The right amount was read from socket - 4 bytes, @@ -2557,8 +2542,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) goto out_fail; } - if (ses->server->dialect >= SMB20_PROT_ID && - (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)) + if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) nohandlecache = ctx->nohandlecache; else nohandlecache = true; @@ -2626,13 +2610,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 extensions\n"); rc = -EOPNOTSUPP; goto out_fail; - } else if (ses->server->vals->protocol_id == SMB10_PROT_ID) - if (cap_unix(ses)) - cifs_dbg(FYI, "Unix Extensions requested on SMB1 mount\n"); - else { - cifs_dbg(VFS, "SMB1 Unix Extensions not supported by server\n"); - rc = -EOPNOTSUPP; - goto out_fail; } else { cifs_dbg(VFS, "Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n"); diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 9ff8ef68a313..38a36d43fd26 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -40,8 +40,13 @@ DEFINE_MUTEX(cifs_mount_mutex); static const match_table_t cifs_smb_version_tokens = { - { Smb_1, SMB1_VERSION_STRING }, - { Smb_20, SMB20_VERSION_STRING}, + /* no longer supported */ + { Smb_1, "1.0" }, + { Smb_1, "1" }, + { Smb_2, "2" }, + { Smb_20, "2.0" }, + + /* supported */ { Smb_21, SMB21_VERSION_STRING }, { Smb_30, SMB30_VERSION_STRING }, { Smb_302, SMB302_VERSION_STRING }, @@ -379,12 +384,14 @@ cifs_parse_smb_version(struct fs_context *fc, char *value, struct smb3_fs_contex substring_t args[MAX_OPT_ARGS]; switch (match_token(value, cifs_smb_version_tokens, args)) { + /* no longer supported */ case Smb_1: - cifs_errorf(fc, "vers=1.0 (cifs) mount not permitted when legacy dialects disabled\n"); - return 1; + case Smb_10: + case Smb_2: case Smb_20: - cifs_errorf(fc, "vers=2.0 mount not permitted when legacy dialects disabled\n"); + cifs_errorf(fc, "SMB version 1.0 and 2.0 are no longer supported in this module\n"); return 1; + /* supported */ case Smb_21: ctx->ops = &smb21_operations; ctx->vals = &smb21_values; @@ -690,7 +697,8 @@ static int smb3_fs_context_validate(struct fs_context *fc) #endif if (ctx->got_version == false) - pr_warn_once("No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount.\n"); + pr_warn_once("No dialect specified on mount. Default is to try negotiating from " + "SMB 2.1 to SMB 3.1.1. SMB 1.0 and 2.0 are no longer supported.\n"); if (!ctx->UNC) { @@ -1399,8 +1407,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, /* If interface changes in mount.cifs bump to new ver */ if (strncasecmp(param->string, "1", 1) == 0) { if (strlen(param->string) > 1) { - pr_warn("Bad mount helper ver=%s. Did you want SMB1 (CIFS) dialect and mean to type vers=1.0 instead?\n", - param->string); + pr_warn("Bad mount helper ver=%s\n", param->string); goto cifs_parse_mount_err; } /* This is the default */ diff --git a/fs/smb/client/fs_context.h b/fs/smb/client/fs_context.h index cf577ec0dd0a..1fb595e20bf1 100644 --- a/fs/smb/client/fs_context.h +++ b/fs/smb/client/fs_context.h @@ -21,8 +21,12 @@ } while (0) enum smb_version { + /* no longer supported */ Smb_1 = 1, + Smb_10, + Smb_2, Smb_20, + /* supported */ Smb_21, Smb_30, Smb_302, diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index 3619d72233f0..6477dde13555 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -891,7 +891,9 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data, switch (data->reparse.tag) { case 0: /* SMB1 symlink */ - break; + pr_warn_once("%s: SMB 1.0 is no longer supported\n", __func__); + rc = -EOPNOTSUPP; + goto out; case IO_REPARSE_TAG_INTERNAL: rc = 0; if (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY) { diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 194a4262d57a..f435fa7d01cd 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -1110,19 +1110,13 @@ SMB2_negotiate(const unsigned int xid, if (ses->chan_max > 1) req->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL); - /* ClientGUID must be zero for SMB2.02 dialect */ - if (server->vals->protocol_id == SMB20_PROT_ID) - memset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE); - else { - memcpy(req->ClientGUID, server->client_guid, - SMB2_CLIENT_GUID_SIZE); - if ((server->vals->protocol_id == SMB311_PROT_ID) || - (strcmp(server->vals->version_string, - SMB3ANY_VERSION_STRING) == 0) || - (strcmp(server->vals->version_string, - SMBDEFAULT_VERSION_STRING) == 0)) - assemble_neg_contexts(req, server, &total_len); - } + memcpy(req->ClientGUID, server->client_guid, SMB2_CLIENT_GUID_SIZE); + + if (server->vals->protocol_id == SMB311_PROT_ID || + !strcmp(server->vals->version_string, SMB3ANY_VERSION_STRING) || + !strcmp(server->vals->version_string, SMBDEFAULT_VERSION_STRING)) + assemble_neg_contexts(req, server, &total_len); + iov[0].iov_base = (char *)req; iov[0].iov_len = total_len; @@ -1145,13 +1139,8 @@ SMB2_negotiate(const unsigned int xid, goto neg_exit; rc = -EIO; - if (strcmp(server->vals->version_string, - SMB3ANY_VERSION_STRING) == 0) { - if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { - cifs_server_dbg(VFS, - "SMB2 dialect returned but not requested\n"); - goto neg_exit; - } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { + if (strcmp(server->vals->version_string, SMB3ANY_VERSION_STRING) == 0) { + if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { cifs_server_dbg(VFS, "SMB2.1 dialect returned but not requested\n"); goto neg_exit; @@ -1159,23 +1148,25 @@ SMB2_negotiate(const unsigned int xid, /* ops set to 3.0 by default for default so update */ server->ops = &smb311_operations; server->vals = &smb311_values; - } - } else if (strcmp(server->vals->version_string, - SMBDEFAULT_VERSION_STRING) == 0) { - if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { - cifs_server_dbg(VFS, - "SMB2 dialect returned but not requested\n"); + } else { + cifs_server_dbg(VFS, "Dialect 0x%x returned but not requested\n", + le16_to_cpu(rsp->DialectRevision)); goto neg_exit; - } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { + } + } else if (strcmp(server->vals->version_string, SMBDEFAULT_VERSION_STRING) == 0) { + if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { /* ops set to 3.0 by default for default so update */ server->ops = &smb21_operations; server->vals = &smb21_values; } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) { server->ops = &smb311_operations; server->vals = &smb311_values; + } else { + cifs_server_dbg(VFS, "Dialect 0x%x returned but not requested\n", + le16_to_cpu(rsp->DialectRevision)); + goto neg_exit; } - } else if (le16_to_cpu(rsp->DialectRevision) != - server->vals->protocol_id) { + } else if (le16_to_cpu(rsp->DialectRevision) != server->vals->protocol_id) { /* if requested single dialect ensure returned dialect matched */ cifs_server_dbg(VFS, "Invalid 0x%x dialect returned: not requested\n", le16_to_cpu(rsp->DialectRevision)); @@ -1184,9 +1175,7 @@ SMB2_negotiate(const unsigned int xid, cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode); - if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) - cifs_dbg(FYI, "negotiated smb2.0 dialect\n"); - else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) + if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) cifs_dbg(FYI, "negotiated smb2.1 dialect\n"); else if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID)) cifs_dbg(FYI, "negotiated smb3.0 dialect\n"); @@ -1195,7 +1184,7 @@ SMB2_negotiate(const unsigned int xid, else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) cifs_dbg(FYI, "negotiated smb3.1.1 dialect\n"); else { - cifs_server_dbg(VFS, "Invalid dialect returned by server 0x%x\n", + cifs_server_dbg(VFS, "Invalid/unsupported dialect returned by server 0x%x\n", le16_to_cpu(rsp->DialectRevision)); goto neg_exit; } diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index 6e68aaf5bd20..8b8e1179e4ed 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -251,8 +251,7 @@ smb_rqst_len(struct TCP_Server_Info *server, struct smb_rqst *rqst) int nvec; unsigned long buflen = 0; - if (!is_smb1(server) && rqst->rq_nvec >= 2 && - rqst->rq_iov[0].iov_len == 4) { + if (rqst->rq_nvec >= 2 && rqst->rq_iov[0].iov_len == 4) { iov = &rqst->rq_iov[1]; nvec = rqst->rq_nvec - 1; } else { @@ -273,7 +272,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, struct smb_rqst *rqst) { int rc; - struct kvec *iov; + struct kvec *iov, hiov; int n_vec; unsigned int send_length = 0; unsigned int i, j; @@ -321,19 +320,16 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, sigprocmask(SIG_BLOCK, &mask, &oldmask); /* Generate a rfc1002 marker for SMB2+ */ - if (!is_smb1(server)) { - struct kvec hiov = { - .iov_base = &rfc1002_marker, - .iov_len = 4 - }; - iov_iter_kvec(&smb_msg.msg_iter, ITER_SOURCE, &hiov, 1, 4); - rc = smb_send_kvec(server, &smb_msg, &sent); - if (rc < 0) - goto unmask; + hiov.iov_base = &rfc1002_marker; + hiov.iov_len = 4; - total_len += sent; - send_length += 4; - } + iov_iter_kvec(&smb_msg.msg_iter, ITER_SOURCE, &hiov, 1, 4); + rc = smb_send_kvec(server, &smb_msg, &sent); + if (rc < 0) + goto unmask; + + total_len += sent; + send_length += 4; cifs_dbg(FYI, "Sending smb: smb_len=%u\n", send_length); |