]>
Commit | Line | Data |
---|---|---|
a4a598b5 GKH |
1 | From 61cabc7b0a5cf0d3c532cfa96594c801743fe7f6 Mon Sep 17 00:00:00 2001 |
2 | From: Ronnie Sahlberg <lsahlber@redhat.com> | |
3 | Date: Fri, 14 Jun 2019 13:02:29 +1000 | |
4 | Subject: cifs: fix GlobalMid_Lock bug in cifs_reconnect | |
5 | ||
6 | From: Ronnie Sahlberg <lsahlber@redhat.com> | |
7 | ||
8 | commit 61cabc7b0a5cf0d3c532cfa96594c801743fe7f6 upstream. | |
9 | ||
10 | We can not hold the GlobalMid_Lock spinlock during the | |
11 | dfs processing in cifs_reconnect since it invokes things that may sleep | |
12 | and thus trigger : | |
13 | ||
14 | BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23 | |
15 | ||
16 | Thus we need to drop the spinlock during this code block. | |
17 | ||
18 | RHBZ: 1716743 | |
19 | ||
20 | Cc: stable@vger.kernel.org | |
21 | Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> | |
22 | Acked-by: Pavel Shilovsky <pshilov@microsoft.com> | |
23 | Signed-off-by: Steve French <stfrench@microsoft.com> | |
24 | Signed-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 |