lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 284/339] cifs: version operations for smb20 unneeded when legacy support disabled
    Date
    From: Steve French <stfrench@microsoft.com>

    [ Upstream commit 7ef93ffccd55fb0ba000ed16ef6a81cd7dee07b5 ]

    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 <lsahlber@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/cifs/cifsglob.h | 4 +++-
    fs/cifs/smb2ops.c | 7 ++++++-
    2 files changed, 9 insertions(+), 2 deletions(-)

    diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
    index e7503c1131a3..a6cade2aebd9 100644
    --- a/fs/cifs/cifsglob.h
    +++ b/fs/cifs/cifsglob.h
    @@ -1929,11 +1929,13 @@ extern mempool_t *cifs_mid_poolp;

    /* Operations for different SMB versions */
    #define SMB1_VERSION_STRING "1.0"
    +#define SMB20_VERSION_STRING "2.0"
    +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
    extern struct smb_version_operations smb1_operations;
    extern struct smb_version_values smb1_values;
    -#define SMB20_VERSION_STRING "2.0"
    extern struct smb_version_operations smb20_operations;
    extern struct smb_version_values smb20_values;
    +#endif /* CIFS_ALLOW_INSECURE_LEGACY */
    #define SMB21_VERSION_STRING "2.1"
    extern struct smb_version_operations smb21_operations;
    extern struct smb_version_values smb21_values;
    diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
    index 861291662c95..6e26edbffc48 100644
    --- a/fs/cifs/smb2ops.c
    +++ b/fs/cifs/smb2ops.c
    @@ -4326,11 +4326,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
    }
    }

    +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
    static bool
    smb2_is_read_op(__u32 oplock)
    {
    return oplock == SMB2_OPLOCK_LEVEL_II;
    }
    +#endif /* CIFS_ALLOW_INSECURE_LEGACY */

    static bool
    smb21_is_read_op(__u32 oplock)
    @@ -5429,7 +5431,7 @@ smb2_make_node(unsigned int xid, struct inode *inode,
    return rc;
    }

    -
    +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
    struct smb_version_operations smb20_operations = {
    .compare_fids = smb2_compare_fids,
    .setup_request = smb2_setup_request,
    @@ -5528,6 +5530,7 @@ struct smb_version_operations smb20_operations = {
    .is_status_io_timeout = smb2_is_status_io_timeout,
    .is_network_name_deleted = smb2_is_network_name_deleted,
    };
    +#endif /* CIFS_ALLOW_INSECURE_LEGACY */

    struct smb_version_operations smb21_operations = {
    .compare_fids = smb2_compare_fids,
    @@ -5859,6 +5862,7 @@ struct smb_version_operations smb311_operations = {
    .is_network_name_deleted = smb2_is_network_name_deleted,
    };

    +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
    struct smb_version_values smb20_values = {
    .version_string = SMB20_VERSION_STRING,
    .protocol_id = SMB20_PROT_ID,
    @@ -5879,6 +5883,7 @@ struct smb_version_values smb20_values = {
    .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
    .create_lease_size = sizeof(struct create_lease),
    };
    +#endif /* ALLOW_INSECURE_LEGACY */

    struct smb_version_values smb21_values = {
    .version_string = SMB21_VERSION_STRING,
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-13 16:07    [W:2.385 / U:0.256 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site