summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.com>2016-01-16 11:59:09 -0500
committerSteve Dickson <steved@redhat.com>2016-01-16 12:30:13 -0500
commit58fc4a61147019183b9a760092d84a713bb0aef4 (patch)
treebd3785d3fc646d04b2367de282c9cba465b73252
parent4b5bd85481a45957122357feebfcd514550fc219 (diff)
downloadnfs-utils-58fc4a61147019183b9a760092d84a713bb0aef4.tar.gz
nfs-utils-58fc4a61147019183b9a760092d84a713bb0aef4.tar.xz
nfs-utils-58fc4a61147019183b9a760092d84a713bb0aef4.zip
Fix uninitialised variable usage in nfs_options2pmap
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> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mount/network.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c
index ebc39d3..8a9bf14 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))