Re: Please try knfsd-981010

H.J. Lu (hjl@lucon.org)
Mon, 12 Oct 1998 08:45:54 -0700 (PDT)


>
> HJ,
>
> I applied your patch, and here are the results. The sequence of events
> is:
>
> - Zero /var/lib/nfs/rmtab and /var/lib/nfs/xtab
> - Start knfsd subsystem using your init script
> - Start gdb and attach per instructions
> - Verify that 'showmount -e' works properly on the server
> - Mount cy:/usr/src from the Alpha machine (works properly)
> - Try running 'showmount -e' on the server (blows up):
>
>
> (gdb) cont
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> get_exportlist () at mountd.c:346
> 346 n = c->gr_next;
>

I guess 'c' is NULL at this point. Please ignore my last patch and
try this one instead.

Thanks.

H.J.

---
Index: utils/mountd/auth.c
===================================================================
RCS file: /home/work/cvs/linux/knfsd/utils/mountd/auth.c,v
retrieving revision 1.7
diff -u -p -r1.7 auth.c
--- auth.c	1998/10/10 23:57:25	1.7
+++ auth.c	1998/10/12 15:19:14
@@ -70,11 +70,15 @@ auth_authenticate_internal(char *what, s
 	if (!(exp = export_find(*hpp, path))) {
 		xlog(L_WARNING, "refused %s request from %s: no export entry",
 				what, (*hpp)->h_name);
+		free (*hpp);
+		*hpp = NULL;
 		return NULL;
 	}
 	if (!exp->m_mayexport) {
 		xlog(L_WARNING, "refused %s request from %s: not exported",
 				what, (*hpp)->h_name);
+		free (*hpp);
+		*hpp = NULL;
 		return NULL;
 	}
 
@@ -83,6 +87,8 @@ auth_authenticate_internal(char *what, s
 	     ntohs(caller->sin_port) >= IPPORT_RESERVED)) {
 		xlog(L_WARNING, "refused %s request from %s: illegal port %d",
 				what, (*hpp)->h_name, ntohs(caller->sin_port));
+		free (*hpp);
+		*hpp = NULL;
 		return NULL;
 	}
 
@@ -106,8 +112,10 @@ auth_authenticate(char *what, struct soc
 
 	/* Try the longest matching exported pathname. */
 	while (1) {
-		if (hp)
+		if (hp) {
 			free (hp);
+			hp = NULL;
+		}
 		exp = auth_authenticate_internal(what, caller, epath, &hp);
 		if (exp) {
 			if (p) {
@@ -128,6 +136,8 @@ auth_authenticate(char *what, struct soc
 		if (p == epath) p++;
 		*p = '\0';
 	}
+	if (hp)
+		free (hp);
 	return exp;
 }
 
Index: utils/mountd/mountd.c
===================================================================
RCS file: /home/work/cvs/linux/knfsd/utils/mountd/mountd.c,v
retrieving revision 1.8
diff -u -p -r1.8 mountd.c
--- mountd.c	1998/10/01 15:03:28	1.8
+++ mountd.c	1998/10/12 15:36:49
@@ -343,7 +343,12 @@ get_exportlist(void)
 				else {
 				  c = n->gr_next;
 				  xfree (n);
-				  n = c->gr_next;
+				  if (c)
+				    n = c->gr_next;
+				  else {
+				    xfree (hp);
+				    break;
+				  }
 				}
 			      }
 			      else {

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/