mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 02:19:54 +00:00
cifs: make sure server interfaces are requested only for SMB3+
Some code paths for querying server interfaces make a false assumption that it will only get called for SMB3+. Since this function now can get called from a generic code paths, the correct thing to do is to have specific handler for this functionality per SMB dialect, and call this handler. This change adds such a handler and implements this handler only for SMB 3.0 and 3.1.1. Cc: stable@vger.kernel.org Cc: Jan Čermák <sairon@sairon.cz> Reported-by: Paulo Alcantara <pc@manguebit.com> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
committed by
Steve French
parent
dc528770ed
commit
13c0a74747
@@ -355,6 +355,9 @@ struct smb_version_operations {
|
|||||||
/* informational QFS call */
|
/* informational QFS call */
|
||||||
void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
|
void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
|
||||||
struct cifs_sb_info *);
|
struct cifs_sb_info *);
|
||||||
|
/* query for server interfaces */
|
||||||
|
int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
|
||||||
|
bool);
|
||||||
/* check if a path is accessible or not */
|
/* check if a path is accessible or not */
|
||||||
int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
|
int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
|
||||||
struct cifs_sb_info *, const char *);
|
struct cifs_sb_info *, const char *);
|
||||||
|
|||||||
@@ -123,12 +123,16 @@ static void smb2_query_server_interfaces(struct work_struct *work)
|
|||||||
struct cifs_tcon *tcon = container_of(work,
|
struct cifs_tcon *tcon = container_of(work,
|
||||||
struct cifs_tcon,
|
struct cifs_tcon,
|
||||||
query_interfaces.work);
|
query_interfaces.work);
|
||||||
|
struct TCP_Server_Info *server = tcon->ses->server;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* query server network interfaces, in case they change
|
* query server network interfaces, in case they change
|
||||||
*/
|
*/
|
||||||
|
if (!server->ops->query_server_interfaces)
|
||||||
|
return;
|
||||||
|
|
||||||
xid = get_xid();
|
xid = get_xid();
|
||||||
rc = SMB3_request_interfaces(xid, tcon, false);
|
rc = server->ops->query_server_interfaces(xid, tcon, false);
|
||||||
free_xid(xid);
|
free_xid(xid);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
|||||||
@@ -5290,6 +5290,7 @@ struct smb_version_operations smb30_operations = {
|
|||||||
.tree_connect = SMB2_tcon,
|
.tree_connect = SMB2_tcon,
|
||||||
.tree_disconnect = SMB2_tdis,
|
.tree_disconnect = SMB2_tdis,
|
||||||
.qfs_tcon = smb3_qfs_tcon,
|
.qfs_tcon = smb3_qfs_tcon,
|
||||||
|
.query_server_interfaces = SMB3_request_interfaces,
|
||||||
.is_path_accessible = smb2_is_path_accessible,
|
.is_path_accessible = smb2_is_path_accessible,
|
||||||
.can_echo = smb2_can_echo,
|
.can_echo = smb2_can_echo,
|
||||||
.echo = SMB2_echo,
|
.echo = SMB2_echo,
|
||||||
@@ -5405,6 +5406,7 @@ struct smb_version_operations smb311_operations = {
|
|||||||
.tree_connect = SMB2_tcon,
|
.tree_connect = SMB2_tcon,
|
||||||
.tree_disconnect = SMB2_tdis,
|
.tree_disconnect = SMB2_tdis,
|
||||||
.qfs_tcon = smb3_qfs_tcon,
|
.qfs_tcon = smb3_qfs_tcon,
|
||||||
|
.query_server_interfaces = SMB3_request_interfaces,
|
||||||
.is_path_accessible = smb2_is_path_accessible,
|
.is_path_accessible = smb2_is_path_accessible,
|
||||||
.can_echo = smb2_can_echo,
|
.can_echo = smb2_can_echo,
|
||||||
.echo = SMB2_echo,
|
.echo = SMB2_echo,
|
||||||
|
|||||||
@@ -409,14 +409,15 @@ skip_sess_setup:
|
|||||||
spin_unlock(&ses->ses_lock);
|
spin_unlock(&ses->ses_lock);
|
||||||
|
|
||||||
if (!rc &&
|
if (!rc &&
|
||||||
(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
|
(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) &&
|
||||||
|
server->ops->query_server_interfaces) {
|
||||||
mutex_unlock(&ses->session_mutex);
|
mutex_unlock(&ses->session_mutex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* query server network interfaces, in case they change
|
* query server network interfaces, in case they change
|
||||||
*/
|
*/
|
||||||
xid = get_xid();
|
xid = get_xid();
|
||||||
rc = SMB3_request_interfaces(xid, tcon, false);
|
rc = server->ops->query_server_interfaces(xid, tcon, false);
|
||||||
free_xid(xid);
|
free_xid(xid);
|
||||||
|
|
||||||
if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
|
if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user