aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/super.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c3d8fcf38523..038b20b38b22 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -600,16 +600,21 @@ static void nfs_umount_begin(struct vfsmount *vfsmnt, int flags)
600} 600}
601 601
602/* 602/*
603 * Sanity-check a server address provided by the mount command 603 * Sanity-check a server address provided by the mount command.
604 *
605 * Address family must be initialized, and address must not be
606 * the ANY address for that family.
604 */ 607 */
605static int nfs_verify_server_address(struct sockaddr *addr) 608static int nfs_verify_server_address(struct sockaddr *addr)
606{ 609{
607 switch (addr->sa_family) { 610 switch (addr->sa_family) {
608 case AF_INET: { 611 case AF_INET: {
609 struct sockaddr_in *sa = (struct sockaddr_in *) addr; 612 struct sockaddr_in *sa = (struct sockaddr_in *)addr;
610 if (sa->sin_addr.s_addr != INADDR_ANY) 613 return sa->sin_addr.s_addr != INADDR_ANY;
611 return 1; 614 }
612 break; 615 case AF_INET6: {
616 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
617 return !ipv6_addr_any(sa);
613 } 618 }
614 } 619 }
615 620