]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: Fix potential deadlock when updating vol in cifs_reconnect()
authorPaulo Alcantara (SUSE) <pc@cjr.nz>
Fri, 23 Jun 2023 21:34:06 +0000 (21:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jun 2023 08:18:37 +0000 (10:18 +0200)
commitbe178a5eae0f3bc48912d1f2b1fa79be3b335748
treec98a07c9123ab8c1837274c0bf578c9bd8eeff9f
parent8a5aaa4562a9ef2ce731e00a658e8bc6489f9aad
cifs: Fix potential deadlock when updating vol in cifs_reconnect()

commit 06d57378bcc9b2c33640945174842115593795d1 upstream.

We can't acquire volume lock while refreshing the DFS cache because
cifs_reconnect() may call dfs_cache_update_vol() while we are walking
through the volume list.

To prevent that, make vol_info refcounted, create a temp list with all
volumes eligible for refreshing, and then use it without any locks
held.

Besides, replace vol_lock with a spinlock and protect cache_ttl from
concurrent accesses or changes.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Rishabh Bhatnagar <risbhat@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/dfs_cache.c