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

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