diff options
| author | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-13 17:54:58 -0300 |
|---|---|---|
| committer | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-14 15:54:44 -0300 |
| commit | 02ad0c3a78c8ad960c5e843ce4adb63433f1b074 (patch) | |
| tree | 8679171bc6666fcfee40f5236757c10555eeb273 | |
| parent | 08b7526684abc39105b742a37c335969bd487aeb (diff) | |
| download | linux-02ad0c3a78c8ad960c5e843ce4adb63433f1b074.tar.gz linux-02ad0c3a78c8ad960c5e843ce4adb63433f1b074.tar.bz2 linux-02ad0c3a78c8ad960c5e843ce4adb63433f1b074.zip | |
smb: client: remove ->validate_negotiate op
Make it static as it's only used in a single place.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
| -rw-r--r-- | fs/smb/client/cifsglob.h | 1 | ||||
| -rw-r--r-- | fs/smb/client/smb2ops.c | 2 | ||||
| -rw-r--r-- | fs/smb/client/smb2pdu.c | 28 | ||||
| -rw-r--r-- | fs/smb/client/smb2proto.h | 1 |
4 files changed, 11 insertions, 21 deletions
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 303074541cb3..7ad100def66f 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -317,7 +317,6 @@ struct smb_version_operations { int (*duplicate_extents)(const unsigned int, struct cifsFileInfo *src, struct cifsFileInfo *target_file, u64 src_off, u64 len, u64 dest_off); - int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, loff_t); /* init transform request - used for encryption for now */ diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 7b834fcf96c9..c6f182e575cb 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -5110,7 +5110,6 @@ struct smb_version_operations smb30_operations = { .create_lease_buf = smb3_create_lease_buf, .parse_lease_buf = smb3_parse_lease_buf, .duplicate_extents = smb2_duplicate_extents, - .validate_negotiate = smb3_validate_negotiate, .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, @@ -5134,7 +5133,6 @@ struct smb_version_operations smb311_operations = { .create_lease_buf = smb3_create_lease_buf, .parse_lease_buf = smb3_parse_lease_buf, .duplicate_extents = smb2_duplicate_extents, -/* .validate_negotiate = smb3_validate_negotiate, */ /* not used in 3.11 */ .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index ecd31baa8c6c..7d10c84ea8e9 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -576,12 +576,10 @@ static int smb2_ioctl_req_init(u32 opcode, struct cifs_tcon *tcon, void **request_buf, unsigned int *total_len) { /* Skip reconnect only for FSCTL_VALIDATE_NEGOTIATE_INFO IOCTLs */ - if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) { - return __smb2_plain_req_init(SMB2_IOCTL, tcon, server, - request_buf, total_len); - } - return smb2_plain_req_init(SMB2_IOCTL, tcon, server, - request_buf, total_len); + if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) + return __smb2_plain_req_init(SMB2_IOCTL, tcon, server, request_buf, total_len); + + return smb2_plain_req_init(SMB2_IOCTL, tcon, server, request_buf, total_len); } /* For explanation of negotiate contexts see MS-SMB2 section 2.2.3.1 */ @@ -1264,7 +1262,7 @@ neg_exit: return rc; } -int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) +static int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) { int rc; struct validate_negotiate_info_req *pneg_inbuf; @@ -1306,12 +1304,10 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) if (tcon->ses->chan_max > 1) pneg_inbuf->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL); - memcpy(pneg_inbuf->Guid, server->client_guid, - SMB2_CLIENT_GUID_SIZE); + memcpy(pneg_inbuf->Guid, server->client_guid, SMB2_CLIENT_GUID_SIZE); if (tcon->ses->sign) - pneg_inbuf->SecurityMode = - cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED); + pneg_inbuf->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED); else if (global_secflags & CIFSSEC_MAY_SIGN) pneg_inbuf->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED); @@ -2134,17 +2130,15 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId); strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); - if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) && - ((tcon->share_flags & SHI1005_FLAGS_DFS) == 0)) + if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) && !(tcon->share_flags & SHI1005_FLAGS_DFS)) cifs_tcon_dbg(VFS, "DFS capability contradicts DFS flag\n"); - if (tcon->seal && - !(server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) + if (tcon->seal && !(server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) cifs_tcon_dbg(VFS, "Encryption is requested but not supported\n"); init_copy_chunk_defaults(tcon); - if (server->ops->validate_negotiate) - rc = server->ops->validate_negotiate(xid, tcon); + if (server->vals->protocol_id == SMB30_PROT_ID) + rc = smb3_validate_negotiate(xid, tcon); if (rc == 0) /* See MS-SMB2 2.2.10 and 3.2.5.5 */ if (tcon->share_flags & SMB2_SHAREFLAG_ISOLATED_TRANSPORT) server->nosharesock = true; diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h index dca7399e0577..c3bee0cc3e28 100644 --- a/fs/smb/client/smb2proto.h +++ b/fs/smb/client/smb2proto.h @@ -304,7 +304,6 @@ extern int smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon, struct smb2_lock_element *buf); extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, __u8 *lease_key, const __le32 lease_state); -extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *); extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *, enum securityEnum); |
