Files
linux/fs/cifs
Paulo Alcantara 5bd3c1c1bc cifs: fix potential deadlock in cache_refresh_path()
[ Upstream commit 9fb0db4051 ]

Avoid getting DFS referral from an exclusive lock in
cache_refresh_path() because the tcon IPC used for getting the
referral could be disconnected and thus causing a deadlock as shown
below:

task A                       task B
======                       ======
cifs_demultiplex_thread()    dfs_cache_find()
 cifs_handle_standard()       cache_refresh_path()
  reconnect_dfs_server()       down_write()
   dfs_cache_noreq_find()       get_dfs_referral()
    down_read() <- deadlock      smb2_get_dfs_refer()
                                  SMB2_ioctl()
				   cifs_send_recv()
				    compound_send_recv()
				     wait_for_response()

where task A cannot wake up task B because it is blocked on
down_read() due to the exclusive lock held in cache_refresh_path() and
therefore not being able to make progress.

Fixes: c9f7110399 ("cifs: keep referral server sessions alive")
Reviewed-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-01 08:27:13 +01:00
..
2021-06-20 21:28:17 -05:00
2023-01-12 11:58:41 +01:00
2023-01-12 11:58:41 +01:00
2020-06-01 00:10:18 -05:00
2023-01-12 11:58:56 +01:00
2022-10-29 10:12:56 +02:00
2022-10-29 10:12:56 +02:00
2022-02-23 12:03:14 +01:00
2023-01-12 11:58:41 +01:00
2023-01-12 11:58:41 +01:00
2019-01-24 09:37:33 -06:00
2021-04-25 16:28:23 -05:00