From: Steve French <smfrench@gmail.com>
To: David Disseldorp <ddiss@suse.de>
Cc: "Paulo Alcantara" <pc@cjr.nz>, CIFS <linux-cifs@vger.kernel.org>,
"Aurélien Aptel" <aaptel@suse.com>,
Stable <stable@vger.kernel.org>
Subject: Re: [PATCH v2] cifs: fix regression when mounting shares with prefix paths
Date: Tue, 4 May 2021 11:58:19 -0500 [thread overview]
Message-ID: <CAH2r5ms9OTgKgr5B=_ac4gyvCb104Cj11mu=zaWjJAiejam14w@mail.gmail.com> (raw)
In-Reply-To: <20210504012027.6deac39a@suse.de>
added acked-by and merged into cifs-2.6.git for-next
On Mon, May 3, 2021 at 6:20 PM David Disseldorp <ddiss@suse.de> wrote:
>
> On Mon, 3 May 2021 11:55:26 -0300, Paulo Alcantara wrote:
>
> > The commit 315db9a05b7a ("cifs: fix leak in cifs_smb3_do_mount() ctx")
> > revealed an existing bug when mounting shares that contain a prefix
> > path or DFS links.
> >
> > cifs_setup_volume_info() requires the @devname to contain the full
> > path (UNC + prefix) to update the fs context with the new UNC and
> > prepath values, however we were passing only the UNC
> > path (old_ctx->UNC) in @device thus discarding any prefix paths.
> >
> > Instead of concatenating both old_ctx->{UNC,prepath} and pass it in
> > @devname, just keep the dup'ed values of UNC and prepath in
> > cifs_sb->ctx after calling smb3_fs_context_dup(), and fix
> > smb3_parse_devname() to correctly parse and not leak the new UNC and
> > prefix paths.
> >
> > Cc: <stable@vger.kernel.org> # v5.11+
> > Fixes: 315db9a05b7a ("cifs: fix leak in cifs_smb3_do_mount() ctx")
> > Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> > ---
> > fs/cifs/cifsfs.c | 8 +-------
> > fs/cifs/connect.c | 24 ++++++++++++++++++------
> > fs/cifs/fs_context.c | 4 ++++
> > 3 files changed, 23 insertions(+), 13 deletions(-)
> >
> > diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> > index 8a6894577697..d7ea9c5fe0f8 100644
> > --- a/fs/cifs/cifsfs.c
> > +++ b/fs/cifs/cifsfs.c
> > @@ -863,13 +863,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
> > goto out;
> > }
> >
> > - /* cifs_setup_volume_info->smb3_parse_devname() redups UNC & prepath */
> > - kfree(cifs_sb->ctx->UNC);
> > - cifs_sb->ctx->UNC = NULL;
> > - kfree(cifs_sb->ctx->prepath);
> > - cifs_sb->ctx->prepath = NULL;
> > -
> > - rc = cifs_setup_volume_info(cifs_sb->ctx, NULL, old_ctx->UNC);
> > + rc = cifs_setup_volume_info(cifs_sb->ctx, NULL, NULL);
>
> IIUC, with the new behaviour, this call becomes pretty much an
> if (!cifs_sb->ctx->username)
> root = ERR_PTR(-EINVAL);
>
> So it might be worth simplifying this further. Either way:
> Acked-by: David Disseldorp <ddiss@suse.de>
>
> Cheers, David
--
Thanks,
Steve
prev parent reply other threads:[~2021-05-04 16:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 22:16 [PATCH] cifs: fix regression when mounting shares with prefix paths Paulo Alcantara
2021-04-30 23:40 ` David Disseldorp
2021-05-03 12:41 ` Paulo Alcantara
2021-05-03 14:55 ` [PATCH v2] " Paulo Alcantara
2021-05-03 23:20 ` David Disseldorp
2021-05-04 16:47 ` Paulo Alcantara
2021-05-04 16:58 ` Steve French [this message]
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='CAH2r5ms9OTgKgr5B=_ac4gyvCb104Cj11mu=zaWjJAiejam14w@mail.gmail.com' \
--to=smfrench@gmail.com \
--cc=aaptel@suse.com \
--cc=ddiss@suse.de \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@cjr.nz \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).