Skip to contentSkip to conversation

cifs: fix hang on cifs_get_next_mid()

PATCH In review Enzo Matsumiya 2 participants 2 messages Jan 7, 2022 – Jan 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: fix hang on cifs_get_next_mid()

Mount will hang if using SMB1 and DFS.

This is because every call to get_next_mid() will, unconditionally, mark tcpStatus to CifsNeedReconnect before even establishing the initial connect, because "reconnect" variable was not initialized.

Initializing "reconnect" to false fix this issue.

Fixes 220c5bc25d87 ("cifs: take cifs_tcp_ses_lock for status checks")
---
 fs/cifs/smb1ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb1ops.c +1 -1
index 54319a789c92..6364c09296e8 100644
@@ -163,7 +163,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
 {
 	__u64 mid = 0;
 	__u16 last_mid, cur_mid;
-	bool collision, reconnect;
+	bool collision, reconnect = false;
 
 	spin_lock(&GlobalMid_Lock);
 
Signature · 1 line
2.34.1
#1 lore raw

tentatively merged into cifs-2.6.git for-next pending testing

Quoted 31 lines · Enzo Matsumiya

Mount will hang if using SMB1 and DFS.

This is because every call to get_next_mid() will, unconditionally, mark tcpStatus to CifsNeedReconnect before even establishing the initial connect, because "reconnect" variable was not initialized.

Initializing "reconnect" to false fix this issue.

Fixes 220c5bc25d87 ("cifs: take cifs_tcp_ses_lock for status checks")
---
 fs/cifs/smb1ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb1ops.c +1 -2
index 54319a789c92..6364c09296e8 100644
@@ -163,7 +163,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
 {
        __u64 mid = 0;
        __u16 last_mid, cur_mid;
-       bool collision, reconnect;
+       bool collision, reconnect = false;
 
        spin_lock(&GlobalMid_Lock);
 
--

2.34.1

Signature · 3 lines
Thanks,

Steve