Skip to content

Commit 7ef93ff

Browse files
author
Steve French
committed
cifs: version operations for smb20 unneeded when legacy support disabled
We should not be including unused smb20 specific code when legacy support is disabled (CONFIG_CIFS_ALLOW_INSECURE_LEGACY turned off). For example smb2_operations and smb2_values aren't used in that case. Over time we can move more and more SMB1/CIFS and SMB2.0 code into the insecure legacy ifdefs Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 387ba9b commit 7ef93ff

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

fs/cifs/cifsglob.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,11 +1963,13 @@ extern mempool_t *cifs_mid_poolp;
19631963

19641964
/* Operations for different SMB versions */
19651965
#define SMB1_VERSION_STRING "1.0"
1966+
#define SMB20_VERSION_STRING "2.0"
1967+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
19661968
extern struct smb_version_operations smb1_operations;
19671969
extern struct smb_version_values smb1_values;
1968-
#define SMB20_VERSION_STRING "2.0"
19691970
extern struct smb_version_operations smb20_operations;
19701971
extern struct smb_version_values smb20_values;
1972+
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
19711973
#define SMB21_VERSION_STRING "2.1"
19721974
extern struct smb_version_operations smb21_operations;
19731975
extern struct smb_version_values smb21_values;

fs/cifs/smb2ops.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4345,11 +4345,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
43454345
}
43464346
}
43474347

4348+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
43484349
static bool
43494350
smb2_is_read_op(__u32 oplock)
43504351
{
43514352
return oplock == SMB2_OPLOCK_LEVEL_II;
43524353
}
4354+
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
43534355

43544356
static bool
43554357
smb21_is_read_op(__u32 oplock)
@@ -5448,7 +5450,7 @@ smb2_make_node(unsigned int xid, struct inode *inode,
54485450
return rc;
54495451
}
54505452

5451-
5453+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
54525454
struct smb_version_operations smb20_operations = {
54535455
.compare_fids = smb2_compare_fids,
54545456
.setup_request = smb2_setup_request,
@@ -5547,6 +5549,7 @@ struct smb_version_operations smb20_operations = {
55475549
.is_status_io_timeout = smb2_is_status_io_timeout,
55485550
.is_network_name_deleted = smb2_is_network_name_deleted,
55495551
};
5552+
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
55505553

55515554
struct smb_version_operations smb21_operations = {
55525555
.compare_fids = smb2_compare_fids,
@@ -5878,6 +5881,7 @@ struct smb_version_operations smb311_operations = {
58785881
.is_network_name_deleted = smb2_is_network_name_deleted,
58795882
};
58805883

5884+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
58815885
struct smb_version_values smb20_values = {
58825886
.version_string = SMB20_VERSION_STRING,
58835887
.protocol_id = SMB20_PROT_ID,
@@ -5898,6 +5902,7 @@ struct smb_version_values smb20_values = {
58985902
.signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
58995903
.create_lease_size = sizeof(struct create_lease),
59005904
};
5905+
#endif /* ALLOW_INSECURE_LEGACY */
59015906

59025907
struct smb_version_values smb21_values = {
59035908
.version_string = SMB21_VERSION_STRING,

0 commit comments

Comments
 (0)