|
Paulo Alcantara |
030304 |
From: Shyam Prasad N <sprasad@microsoft.com>
|
|
Paulo Alcantara |
030304 |
Date: Wed, 6 Jul 2022 14:29:12 +0000
|
|
Paulo Alcantara |
030304 |
Subject: [PATCH] cifs: remove unnecessary locking of chan_lock while freeing
|
|
Paulo Alcantara |
030304 |
session
|
|
Paulo Alcantara |
030304 |
Git-commit: 2883f4b5a0e1ac9472c7e3ae9bbdb4ea5a2117c6
|
|
Paulo Alcantara |
030304 |
References: bsc#1193629
|
|
Paulo Alcantara |
030304 |
Patch-mainline: v5.19-rc7
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
In cifs_put_smb_ses, when we're freeing the last ref count to
|
|
Paulo Alcantara |
030304 |
the session, we need to free up each channel. At this point,
|
|
Paulo Alcantara |
030304 |
it is unnecessary to take chan_lock, since we have the last
|
|
Paulo Alcantara |
030304 |
reference to the ses.
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
Picking up this lock also introduced a deadlock because it calls
|
|
Paulo Alcantara |
030304 |
cifs_put_tcp_ses, which locks cifs_tcp_ses_lock.
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
|
|
Paulo Alcantara |
030304 |
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
|
|
Paulo Alcantara |
030304 |
Signed-off-by: Steve French <stfrench@microsoft.com>
|
|
Paulo Alcantara |
030304 |
Acked-by: Paulo Alcantara <palcantara@suse.de>
|
|
Paulo Alcantara |
030304 |
---
|
|
Paulo Alcantara |
030304 |
fs/cifs/connect.c | 2 --
|
|
Paulo Alcantara |
030304 |
1 file changed, 2 deletions(-)
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
|
|
Paulo Alcantara |
030304 |
index fa29c9aae24b..386bb523c69e 100644
|
|
Paulo Alcantara |
030304 |
--- a/fs/cifs/connect.c
|
|
Paulo Alcantara |
030304 |
+++ b/fs/cifs/connect.c
|
|
Paulo Alcantara |
030304 |
@@ -1918,7 +1918,6 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
|
|
Paulo Alcantara |
030304 |
list_del_init(&ses->smb_ses_list);
|
|
Paulo Alcantara |
030304 |
spin_unlock(&cifs_tcp_ses_lock);
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
- spin_lock(&ses->chan_lock);
|
|
Paulo Alcantara |
030304 |
chan_count = ses->chan_count;
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
/* close any extra channels */
|
|
Paulo Alcantara |
030304 |
@@ -1934,7 +1933,6 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
|
|
Paulo Alcantara |
030304 |
ses->chans[i].server = NULL;
|
|
Paulo Alcantara |
030304 |
}
|
|
Paulo Alcantara |
030304 |
}
|
|
Paulo Alcantara |
030304 |
- spin_unlock(&ses->chan_lock);
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
sesInfoFree(ses);
|
|
Paulo Alcantara |
030304 |
cifs_put_tcp_session(server, 0);
|
|
Paulo Alcantara |
030304 |
--
|
|
Paulo Alcantara |
030304 |
2.37.3
|
|
Paulo Alcantara |
030304 |
|
|
Paulo Alcantara |
030304 |
|