From: Steve French <smfrench@gmail.com>
To: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH] cifs: fix NULL dereference in match_prepath
Date: Tue, 21 Jan 2020 19:29:33 -0600 [thread overview]
Message-ID: <CAH2r5mv8cPqGaBzAOfvDhYt_Mf4Rw4k0_2q85OWxhTsOPGp8Ng@mail.gmail.com> (raw)
In-Reply-To: <20200122010756.30245-1-lsahlber@redhat.com>
merged into cifs-2.6.git for-next
On Tue, Jan 21, 2020 at 7:08 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> RHBZ: 1760879
>
> Fix an oops in match_prepath() by making sure that the prepath string is not
> NULL before we pass it into strcmp().
>
> This is similar to other checks we make for example in cifs_root_iget()
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
> fs/cifs/connect.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 05ea0e2b7e0e..0aa3623ae0e1 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3709,8 +3709,10 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
> {
> struct cifs_sb_info *old = CIFS_SB(sb);
> struct cifs_sb_info *new = mnt_data->cifs_sb;
> - bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
> - bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
> + bool old_set = (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
> + old->prepath;
> + bool new_set = (new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
> + new->prepath;
>
> if (old_set && new_set && !strcmp(new->prepath, old->prepath))
> return 1;
> --
> 2.13.6
>
--
Thanks,
Steve
prev parent reply other threads:[~2020-01-22 1:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-22 1:07 [PATCH] cifs: fix NULL dereference in match_prepath Ronnie Sahlberg
2020-01-22 1:29 ` 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=CAH2r5mv8cPqGaBzAOfvDhYt_Mf4Rw4k0_2q85OWxhTsOPGp8Ng@mail.gmail.com \
--to=smfrench@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=lsahlber@redhat.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;
as well as URLs for NNTP newsgroup(s).