Skip to content

Commit 0a2e0ba

Browse files
Paulo Alcantaragregkh
authored andcommitted
cifs: prevent infinite recursion in CIFSGetDFSRefer()
commit 09ba47b upstream. We can't call smb_init() in CIFSGetDFSRefer() as cifs_reconnect_tcon() may end up calling CIFSGetDFSRefer() again to get new DFS referrals and thus causing an infinite recursion. Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Cc: stable@vger.kernel.org # 6.2 Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a5075c0 commit 0a2e0ba

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

fs/cifs/cifssmb.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4751,8 +4751,13 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
47514751
return -ENODEV;
47524752

47534753
getDFSRetry:
4754-
rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, (void **) &pSMB,
4755-
(void **) &pSMBr);
4754+
/*
4755+
* Use smb_init_no_reconnect() instead of smb_init() as
4756+
* CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus
4757+
* causing an infinite recursion.
4758+
*/
4759+
rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
4760+
(void **)&pSMB, (void **)&pSMBr);
47564761
if (rc)
47574762
return rc;
47584763

0 commit comments

Comments
 (0)