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

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