Skip to contentSkip to conversation

NFSv4: handle lack of clientaddr in option string gracefully

PATCH New Jeff Layton 1 participant 1 message Jul 18, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4: handle lack of clientaddr in option string gracefully

If a NFSv4 mount is attempted with string based options, and the option string doesn't contain a clientaddr= option, the kernel will currently oops. Check for this situation and return a proper error.

fs/nfs/super.c +7 -0
index a2b1af8..ff06b95 100644
@@ -1683,6 +1683,9 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options,
 
 		dprintk("MNTPATH: %s\n", *mntpath);
 
+		if (args.client_address == NULL)
+			goto out_no_client_address;
+
 		*ip_addr = args.client_address;
 
 		break;
@@ -1703,6 +1706,10 @@ out_inval_auth:
 out_no_address:
 	dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n");
 	return -EINVAL;
+
+out_no_client_address:
+	dfprintk(MOUNT, "NFS4: mount program didn't pass callback address\n");
+	return -EINVAL;
 }
 
 /*