- nfs-refactor-ip-address-sanity-checks-in-nfs-client.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     NFS: refactor IP address sanity checks in NFS client
has been removed from the -mm tree.  Its filename was
     nfs-refactor-ip-address-sanity-checks-in-nfs-client.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
Subject: NFS: refactor IP address sanity checks in NFS client
From: Chuck Lever <chuck.lever@xxxxxxxxxx>

Provide mechanism for adding IPv6 address support at some later point.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
Cc: Aurelien Charbon <aurelien.charbon@xxxxxxxxxxxx>
Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxx>
Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/nfs/super.c |   39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff -puN fs/nfs/super.c~nfs-refactor-ip-address-sanity-checks-in-nfs-client fs/nfs/super.c
--- a/fs/nfs/super.c~nfs-refactor-ip-address-sanity-checks-in-nfs-client
+++ a/fs/nfs/super.c
@@ -448,6 +448,28 @@ static void nfs_umount_begin(struct vfsm
 }
 
 /*
+ * Sanity-check a server address provided by the mount command
+ */
+static int nfs_verify_server_address(struct sockaddr *addr, size_t len)
+{
+	if (len > sizeof(struct sockaddr))
+		goto out_invalid;
+
+	switch (addr->sa_family) {
+	case AF_INET: {
+		struct sockaddr_in *sa = (struct sockaddr_in *) addr;
+		if (sa->sin_addr.s_addr != INADDR_ANY)
+			return 1;
+		break;
+	}
+	}
+
+out_invalid:
+	dprintk("NFS: mount program passed an invalid remote address\n");
+	return 0;
+}
+
+/*
  * Validate the NFS2/NFS3 mount data
  * - fills in the mount root filehandle
  */
@@ -502,11 +524,9 @@ static int nfs_validate_mount_data(struc
 #endif /* CONFIG_NFS_V3 */
 
 	/* We now require that the mount process passes the remote address */
-	if (data->addr.sin_addr.s_addr == INADDR_ANY) {
-		dprintk("%s: mount program didn't pass remote address!\n",
-			__FUNCTION__);
-		return -EINVAL;
-	}
+	if (!nfs_verify_server_address((struct sockaddr *) &data->addr,
+						sizeof(data->addr)))
+ 		return -EINVAL;
 
 	/* Prepare the root filehandle */
 	if (data->flags & NFS_MOUNT_VER3)
@@ -890,13 +910,10 @@ static int nfs4_get_sb(struct file_syste
 	if (copy_from_user(&addr, data->host_addr, sizeof(addr)))
 		return -EFAULT;
 
-	if (addr.sin_family != AF_INET ||
-	    addr.sin_addr.s_addr == INADDR_ANY
-	    ) {
-		dprintk("%s: mount program didn't pass remote IP address!\n",
-				__FUNCTION__);
+	if (!nfs_verify_server_address((struct sockaddr *) &addr,
+					data->host_addrlen))
 		return -EINVAL;
-	}
+
 	/* RFC3530: The default port for NFS is 2049 */
 	if (addr.sin_port == 0)
 		addr.sin_port = htons(NFS_PORT);
_

Patches currently in -mm which might be from chuck.lever@xxxxxxxxxx are

git-nfs.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux