cifs: all initializations for tcon should happen in tcon_info_alloc
commit 74ebd02163fde05baa23129e06dde4b8f0f2377a upstream. Today, a few work structs inside tcon are initialized inside cifs_get_tcon and not in tcon_info_alloc. As a result, if a tcon is obtained from tcon_info_alloc, but not called as a part of cifs_get_tcon, we may trip over. Cc: <stable@vger.kernel.org> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7b02e09fc0
commit
631f9de9a7
@@ -136,6 +136,7 @@ extern int SendReceiveBlockingLock(const unsigned int xid,
|
|||||||
struct smb_hdr *out_buf,
|
struct smb_hdr *out_buf,
|
||||||
int *bytes_returned);
|
int *bytes_returned);
|
||||||
|
|
||||||
|
void smb2_query_server_interfaces(struct work_struct *work);
|
||||||
void
|
void
|
||||||
cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
|
cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
|
||||||
bool all_channels);
|
bool all_channels);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void smb2_query_server_interfaces(struct work_struct *work)
|
void smb2_query_server_interfaces(struct work_struct *work)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
int xid;
|
int xid;
|
||||||
@@ -2819,20 +2819,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
|
|||||||
tcon->max_cached_dirs = ctx->max_cached_dirs;
|
tcon->max_cached_dirs = ctx->max_cached_dirs;
|
||||||
tcon->nodelete = ctx->nodelete;
|
tcon->nodelete = ctx->nodelete;
|
||||||
tcon->local_lease = ctx->local_lease;
|
tcon->local_lease = ctx->local_lease;
|
||||||
INIT_LIST_HEAD(&tcon->pending_opens);
|
|
||||||
tcon->status = TID_GOOD;
|
tcon->status = TID_GOOD;
|
||||||
|
|
||||||
INIT_DELAYED_WORK(&tcon->query_interfaces,
|
|
||||||
smb2_query_server_interfaces);
|
|
||||||
if (ses->server->dialect >= SMB30_PROT_ID &&
|
if (ses->server->dialect >= SMB30_PROT_ID &&
|
||||||
(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
|
(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
|
||||||
/* schedule query interfaces poll */
|
/* schedule query interfaces poll */
|
||||||
queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
|
queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
|
||||||
(SMB_INTERFACE_POLL_INTERVAL * HZ));
|
(SMB_INTERFACE_POLL_INTERVAL * HZ));
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
|
||||||
INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh);
|
|
||||||
#endif
|
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_add(&tcon->tcon_list, &ses->tcon_list);
|
list_add(&tcon->tcon_list, &ses->tcon_list);
|
||||||
spin_unlock(&cifs_tcp_ses_lock);
|
spin_unlock(&cifs_tcp_ses_lock);
|
||||||
|
|||||||
@@ -148,6 +148,12 @@ tcon_info_alloc(bool dir_leases_enabled, enum smb3_tcon_ref_trace trace)
|
|||||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||||
INIT_LIST_HEAD(&ret_buf->dfs_ses_list);
|
INIT_LIST_HEAD(&ret_buf->dfs_ses_list);
|
||||||
#endif
|
#endif
|
||||||
|
INIT_LIST_HEAD(&ret_buf->pending_opens);
|
||||||
|
INIT_DELAYED_WORK(&ret_buf->query_interfaces,
|
||||||
|
smb2_query_server_interfaces);
|
||||||
|
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||||
|
INIT_DELAYED_WORK(&ret_buf->dfs_cache_work, dfs_cache_refresh);
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret_buf;
|
return ret_buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user