Skip to content

Commit e41e334

Browse files
metze-sambagregkh
authored andcommitted
smb: server: split ksmbd_rdma_stop_listening() out of ksmbd_rdma_destroy()
[ Upstream commit bac7b99 ] We can't call destroy_workqueue(smb_direct_wq); before stop_sessions()! Otherwise already existing connections try to use smb_direct_wq as a NULL pointer. Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Fixes: 0626e66 ("cifsd: add server handler for central processing and tranport layers") Signed-off-by: Stefan Metzmacher <metze@samba.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a69da89 commit e41e334

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

fs/smb/server/connection.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ void ksmbd_conn_transport_destroy(void)
504504
{
505505
mutex_lock(&init_lock);
506506
ksmbd_tcp_destroy();
507-
ksmbd_rdma_destroy();
507+
ksmbd_rdma_stop_listening();
508508
stop_sessions();
509+
ksmbd_rdma_destroy();
509510
mutex_unlock(&init_lock);
510511
}

fs/smb/server/transport_rdma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ int ksmbd_rdma_init(void)
21942194
return 0;
21952195
}
21962196

2197-
void ksmbd_rdma_destroy(void)
2197+
void ksmbd_rdma_stop_listening(void)
21982198
{
21992199
if (!smb_direct_listener.cm_id)
22002200
return;
@@ -2203,7 +2203,10 @@ void ksmbd_rdma_destroy(void)
22032203
rdma_destroy_id(smb_direct_listener.cm_id);
22042204

22052205
smb_direct_listener.cm_id = NULL;
2206+
}
22062207

2208+
void ksmbd_rdma_destroy(void)
2209+
{
22072210
if (smb_direct_wq) {
22082211
destroy_workqueue(smb_direct_wq);
22092212
smb_direct_wq = NULL;

fs/smb/server/transport_rdma.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ struct smb_direct_data_transfer {
5454

5555
#ifdef CONFIG_SMB_SERVER_SMBDIRECT
5656
int ksmbd_rdma_init(void);
57+
void ksmbd_rdma_stop_listening(void);
5758
void ksmbd_rdma_destroy(void);
5859
bool ksmbd_rdma_capable_netdev(struct net_device *netdev);
5960
void init_smbd_max_io_size(unsigned int sz);
6061
unsigned int get_smbd_max_read_write_size(void);
6162
#else
6263
static inline int ksmbd_rdma_init(void) { return 0; }
63-
static inline int ksmbd_rdma_destroy(void) { return 0; }
64+
static inline void ksmbd_rdma_stop_listening(void) { }
65+
static inline void ksmbd_rdma_destroy(void) { }
6466
static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
6567
static inline void init_smbd_max_io_size(unsigned int sz) { }
6668
static inline unsigned int get_smbd_max_read_write_size(void) { return 0; }

0 commit comments

Comments
 (0)