From: NeilBrown <neilb@suse.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: linux-nfs@vger.kernel.org, Andreas Schwab <schwab@suse.com>
Subject: [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap
Date: Thu, 17 Dec 2015 12:56:34 +1100 [thread overview]
Message-ID: <20151217015634.19978.77514.stgit@noble> (raw)
In-Reply-To: <20151217015524.19978.63114.stgit@noble>
From: Andreas Schwab <schwab@suse.com>
Commit 5bea22e33b7a introduced a regression. Prior to that commit
nfs_nfs_version would set *version to 0 if NFS version wasn't specified.
Since that commit, version.v_mode is set to V_DEFAULT if the NFS version
isn't specified, but nfs_options2pmap uses version.major without checking
v_mode. This can lead to incorrect behaviour.
In particular fall-ack to v3 if server doesn't support v4 can fail.
So test v_mode before using version.major.
URL: https://bugzilla.opensuse.org/show_bug.cgi?id=956743
Fixes: 5bea22e33b7a ("mount.nfs: Add struct nfs_version and generalize version parsing")
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/mount/network.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index ebc39d361e2c..8a9bf1476d51 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1631,7 +1631,10 @@ int nfs_options2pmap(struct mount_options *options,
return 0;
if (!nfs_nfs_version(options, &version))
return 0;
- nfs_pmap->pm_vers = version.major;
+ if (version.v_mode == V_DEFAULT)
+ nfs_pmap->pm_vers = 0;
+ else
+ nfs_pmap->pm_vers = version.major;
if (!nfs_nfs_protocol(options, &nfs_pmap->pm_prot))
return 0;
if (!nfs_nfs_port(options, &nfs_pmap->pm_port))
next prev parent reply other threads:[~2015-12-17 1:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
2015-12-17 1:56 ` [PATCH 2/2] Fix protocol minor version fall-back NeilBrown
2015-12-17 1:56 ` NeilBrown [this message]
2016-01-16 21:57 ` [PATCH nfs-utils 0/2] fixes for protocol fallback on mount Steve Dickson
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=20151217015634.19978.77514.stgit@noble \
--to=neilb@suse.com \
--cc=SteveD@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=schwab@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.