cifs: Fix potential softlockups while refreshing DFS cache
authorPaulo Alcantara (SUSE) <pc@cjr.nz>
Fri, 22 Nov 2019 15:30:53 +0000 (12:30 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:20:03 +0000 (10:20 +0100)
commit3d29dc60aac16831b1822c831a7f40b45a9686d9
treef0eafaed5b9951cd5758d3f0c10cd2673ac99267
parent6eaf5653ddab9ce8572f50d2e477e8cddba4994d
cifs: Fix potential softlockups while refreshing DFS cache

commit 84a1f5b1cc6fd7f6cd99fc5630c36f631b19fa60 upstream.

We used to skip reconnects on all SMB2_IOCTL commands due to SMB3+
FSCTL_VALIDATE_NEGOTIATE_INFO - which made sense since we're still
establishing a SMB session.

However, when refresh_cache_worker() calls smb2_get_dfs_refer() and
we're under reconnect, SMB2_ioctl() will not be able to get a proper
status error (e.g. -EHOSTDOWN in case we failed to reconnect) but an
-EAGAIN from cifs_send_recv() thus looping forever in
refresh_cache_worker().

Fixes: e99c63e4d86d ("SMB3: Fix deadlock in validate negotiate hits reconnect")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Suggested-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2pdu.c