]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.1/cifs-fix-globalmid_lock-bug-in-cifs_reconnect.patch
fixes for 5.1
[thirdparty/kernel/stable-queue.git] / queue-5.1 / cifs-fix-globalmid_lock-bug-in-cifs_reconnect.patch
CommitLineData
a4a598b5
GKH
1From 61cabc7b0a5cf0d3c532cfa96594c801743fe7f6 Mon Sep 17 00:00:00 2001
2From: Ronnie Sahlberg <lsahlber@redhat.com>
3Date: Fri, 14 Jun 2019 13:02:29 +1000
4Subject: cifs: fix GlobalMid_Lock bug in cifs_reconnect
5
6From: Ronnie Sahlberg <lsahlber@redhat.com>
7
8commit 61cabc7b0a5cf0d3c532cfa96594c801743fe7f6 upstream.
9
10We can not hold the GlobalMid_Lock spinlock during the
11dfs processing in cifs_reconnect since it invokes things that may sleep
12and thus trigger :
13
14BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23
15
16Thus we need to drop the spinlock during this code block.
17
18RHBZ: 1716743
19
20Cc: stable@vger.kernel.org
21Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
22Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
23Signed-off-by: Steve French <stfrench@microsoft.com>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 fs/cifs/connect.c | 2 ++
28 1 file changed, 2 insertions(+)
29
30--- a/fs/cifs/connect.c
31+++ b/fs/cifs/connect.c
32@@ -478,6 +478,7 @@ cifs_reconnect(struct TCP_Server_Info *s
33 spin_lock(&GlobalMid_Lock);
34 server->nr_targets = 1;
35 #ifdef CONFIG_CIFS_DFS_UPCALL
36+ spin_unlock(&GlobalMid_Lock);
37 cifs_sb = find_super_by_tcp(server);
38 if (IS_ERR(cifs_sb)) {
39 rc = PTR_ERR(cifs_sb);
40@@ -495,6 +496,7 @@ cifs_reconnect(struct TCP_Server_Info *s
41 }
42 cifs_dbg(FYI, "%s: will retry %d target(s)\n", __func__,
43 server->nr_targets);
44+ spin_lock(&GlobalMid_Lock);
45 #endif
46 if (server->tcpStatus == CifsExiting) {
47 /* the demux thread will exit normally