From: Paulo Alcantara <pc@manguebit.com>
To: smfrench@gmail.com
Cc: linux-cifs@vger.kernel.org, Paulo Alcantara <pc@manguebit.com>
Subject: [PATCH 4/5] cifs: prevent infinite recursion in CIFSGetDFSRefer()
Date: Wed, 29 Mar 2023 17:14:22 -0300 [thread overview]
Message-ID: <20230329201423.32134-4-pc@manguebit.com> (raw)
In-Reply-To: <20230329201423.32134-1-pc@manguebit.com>
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
next prev parent reply other threads:[~2023-03-29 20:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 20:14 [PATCH 1/5] cifs: get rid of cifs_mount_ctx::{origin,leaf}_fullpath Paulo Alcantara
2023-03-29 20:14 ` [PATCH 2/5] cifs: get rid of unnecessary ifdef Paulo Alcantara
2023-03-29 20:25 ` ronnie sahlberg
2023-03-29 20:14 ` [PATCH 3/5] cifs: avoid races in parallel reconnects in smb1 Paulo Alcantara
2023-03-29 20:27 ` ronnie sahlberg
2023-03-30 22:59 ` Steve French
2023-03-29 20:14 ` Paulo Alcantara [this message]
2023-03-29 20:27 ` [PATCH 4/5] cifs: prevent infinite recursion in CIFSGetDFSRefer() ronnie sahlberg
2023-03-30 22:59 ` Steve French
2023-03-29 20:14 ` [PATCH 5/5] cifs: get rid of dead check in smb2_reconnect() Paulo Alcantara
2023-03-29 20:28 ` ronnie sahlberg
2023-03-30 22:59 ` Steve French
2023-03-29 20:24 ` [PATCH 1/5] cifs: get rid of cifs_mount_ctx::{origin,leaf}_fullpath ronnie sahlberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230329201423.32134-4-pc@manguebit.com \
--to=pc@manguebit.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox