Blame SOURCES/nfs-utils-1.3.0-mount-uninit-structs.patch

fc3648
commit 0712b5507866d6b3c900623eb1f81fffaec80ae2
fc3648
Author: Jianhong Yin <yin-jianhong@163.com>
fc3648
Date:   Thu Feb 2 06:21:15 2017 -0500
fc3648
fc3648
    mount: fix mount fail that caused by uninitialized struct
fc3648
    
fc3648
    From: "Jianhong.Yin" <yin-jianhong@163.com>
fc3648
    
fc3648
    recent changes of utils/mount cause a regression mount fail:
fc3648
      https://bugzilla.redhat.com/show_bug.cgi?id=1415024
fc3648
    can not reproduce it on x86_64(gcc on x86_64 might do struct
fc3648
    initialize by default, I'm not sure). but it can be reproduced
fc3648
    always on platform ppc64le aarch64.
fc3648
    
fc3648
    Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
fc3648
    Signed-off-by: Steve Dickson <steved@redhat.com>
fc3648
fc3648
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
fc3648
index 4d18d35..77125f1 100644
fc3648
--- a/utils/gssd/gssd.c
fc3648
+++ b/utils/gssd/gssd.c
fc3648
@@ -87,6 +87,7 @@ int  root_uses_machine_creds = 1;
fc3648
 unsigned int  context_timeout = 0;
fc3648
 unsigned int  rpc_timeout = 5;
fc3648
 char *preferred_realm = NULL;
fc3648
+char *ccachedir = NULL;
fc3648
 /* Avoid DNS reverse lookups on server names */
fc3648
 static bool avoid_dns = true;
fc3648
 int thread_started = false;
fc3648
@@ -837,18 +838,9 @@ usage(char *progname)
fc3648
 	exit(1);
fc3648
 }
fc3648
 
fc3648
-int
fc3648
-main(int argc, char *argv[])
fc3648
+inline static void 
fc3648
+read_gss_conf(void)
fc3648
 {
fc3648
-	int fg = 0;
fc3648
-	int verbosity = 0;
fc3648
-	int rpc_verbosity = 0;
fc3648
-	int opt;
fc3648
-	int i;
fc3648
-	extern char *optarg;
fc3648
-	char *progname;
fc3648
-	char *ccachedir = NULL;
fc3648
-	struct event sighup_ev;
fc3648
 	char *s;
fc3648
 
fc3648
 	conf_init();
fc3648
@@ -877,6 +869,22 @@ main(int argc, char *argv[])
fc3648
 	if (s)
fc3648
 		preferred_realm = s;
fc3648
 
fc3648
+}
fc3648
+
fc3648
+int
fc3648
+main(int argc, char *argv[])
fc3648
+{
fc3648
+	int fg = 0;
fc3648
+	int verbosity = 0;
fc3648
+	int rpc_verbosity = 0;
fc3648
+	int opt;
fc3648
+	int i;
fc3648
+	extern char *optarg;
fc3648
+	char *progname;
fc3648
+	struct event sighup_ev;
fc3648
+
fc3648
+	read_gss_conf();
fc3648
+
fc3648
 	while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
fc3648
 		switch (opt) {
fc3648
 			case 'f':
fc3648
diff --git a/utils/mount/network.c b/utils/mount/network.c
fc3648
index 7dceb2d..d1c8fec 100644
fc3648
--- a/utils/mount/network.c
fc3648
+++ b/utils/mount/network.c
fc3648
@@ -1638,6 +1638,7 @@ int nfs_options2pmap(struct mount_options *options,
fc3648
 		     struct pmap *nfs_pmap, struct pmap *mnt_pmap)
fc3648
 {
fc3648
 	struct nfs_version version;
fc3648
+	memset(&version, 0, sizeof(version));
fc3648
 
fc3648
 	if (!nfs_nfs_program(options, &nfs_pmap->pm_prog))
fc3648
 		return 0;
fc3648
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
fc3648
index 387d734..a9ff95d 100644
fc3648
--- a/utils/mount/stropts.c
fc3648
+++ b/utils/mount/stropts.c
fc3648
@@ -517,6 +517,10 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options, int checkv4)
fc3648
 	unsigned long protocol;
fc3648
 	struct pmap mnt_pmap;
fc3648
 
fc3648
+	/* initialize structs */
fc3648
+	memset(&nfs_pmap, 0, sizeof(struct pmap));
fc3648
+	memset(&mnt_pmap, 0, sizeof(struct pmap));
fc3648
+
fc3648
 	/*
fc3648
 	 * Version and transport negotiation is not required
fc3648
 	 * and does not work for RDMA mounts.