Message ID | 20230329201423.32134-4-pc@manguebit.com |
---|---|
State | New |
Headers | show |
Series | [1/5] cifs: get rid of cifs_mount_ctx::{origin,leaf}_fullpath | expand |
reviewed-by me On Thu, 30 Mar 2023 at 06:20, Paulo Alcantara <pc@manguebit.com> wrote: > > 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> > --- > fs/cifs/cifssmb.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c > index c9d57ba84be4..0d30b17494e4 100644 > --- a/fs/cifs/cifssmb.c > +++ b/fs/cifs/cifssmb.c > @@ -4382,8 +4382,13 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, > return -ENODEV; > > getDFSRetry: > - rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, (void **) &pSMB, > - (void **) &pSMBr); > + /* > + * Use smb_init_no_reconnect() instead of smb_init() as > + * CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus > + * causing an infinite recursion. > + */ > + rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, > + (void **)&pSMB, (void **)&pSMBr); > if (rc) > return rc; > > -- > 2.40.0 >
added cc:stable and added ronnie's RB and merged into cifs-2.6.git for-next On Wed, Mar 29, 2023 at 3:14 PM Paulo Alcantara <pc@manguebit.com> wrote: > > 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> > --- > fs/cifs/cifssmb.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c > index c9d57ba84be4..0d30b17494e4 100644 > --- a/fs/cifs/cifssmb.c > +++ b/fs/cifs/cifssmb.c > @@ -4382,8 +4382,13 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, > return -ENODEV; > > getDFSRetry: > - rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, (void **) &pSMB, > - (void **) &pSMBr); > + /* > + * Use smb_init_no_reconnect() instead of smb_init() as > + * CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus > + * causing an infinite recursion. > + */ > + rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, > + (void **)&pSMB, (void **)&pSMBr); > if (rc) > return rc; > > -- > 2.40.0 >
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index c9d57ba84be4..0d30b17494e4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -4382,8 +4382,13 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, return -ENODEV; getDFSRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, (void **) &pSMB, - (void **) &pSMBr); + /* + * Use smb_init_no_reconnect() instead of smb_init() as + * CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus + * causing an infinite recursion. + */ + rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, + (void **)&pSMB, (void **)&pSMBr); if (rc) return rc;
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> --- fs/cifs/cifssmb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)