mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	NFSv4: Refuse mount attempts with proto=udp
RFC3530 disallows the use of udp as a transport protocol for NFSv4. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
		
							parent
							
								
									9597c13b2f
								
							
						
					
					
						commit
						6da1a03436
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -2084,6 +2084,8 @@ static int nfs_validate_text_mount_data(void *options,
 | 
				
			||||||
		max_namelen = NFS4_MAXNAMLEN;
 | 
							max_namelen = NFS4_MAXNAMLEN;
 | 
				
			||||||
		max_pathlen = NFS4_MAXPATHLEN;
 | 
							max_pathlen = NFS4_MAXPATHLEN;
 | 
				
			||||||
		nfs_validate_transport_protocol(args);
 | 
							nfs_validate_transport_protocol(args);
 | 
				
			||||||
 | 
							if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP)
 | 
				
			||||||
 | 
								goto out_invalid_transport_udp;
 | 
				
			||||||
		nfs4_validate_mount_flags(args);
 | 
							nfs4_validate_mount_flags(args);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
		goto out_v4_not_compiled;
 | 
							goto out_v4_not_compiled;
 | 
				
			||||||
| 
						 | 
					@ -2106,6 +2108,10 @@ static int nfs_validate_text_mount_data(void *options,
 | 
				
			||||||
out_v4_not_compiled:
 | 
					out_v4_not_compiled:
 | 
				
			||||||
	dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
 | 
						dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
 | 
				
			||||||
	return -EPROTONOSUPPORT;
 | 
						return -EPROTONOSUPPORT;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					out_invalid_transport_udp:
 | 
				
			||||||
 | 
						dfprintk(MOUNT, "NFSv4: Unsupported transport protocol udp\n");
 | 
				
			||||||
 | 
						return -EINVAL;
 | 
				
			||||||
#endif /* !CONFIG_NFS_V4 */
 | 
					#endif /* !CONFIG_NFS_V4 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out_no_address:
 | 
					out_no_address:
 | 
				
			||||||
| 
						 | 
					@ -2711,6 +2717,8 @@ static int nfs4_validate_mount_data(void *options,
 | 
				
			||||||
		args->acdirmax	= data->acdirmax;
 | 
							args->acdirmax	= data->acdirmax;
 | 
				
			||||||
		args->nfs_server.protocol = data->proto;
 | 
							args->nfs_server.protocol = data->proto;
 | 
				
			||||||
		nfs_validate_transport_protocol(args);
 | 
							nfs_validate_transport_protocol(args);
 | 
				
			||||||
 | 
							if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP)
 | 
				
			||||||
 | 
								goto out_invalid_transport_udp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					@ -2731,6 +2739,10 @@ static int nfs4_validate_mount_data(void *options,
 | 
				
			||||||
out_no_address:
 | 
					out_no_address:
 | 
				
			||||||
	dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n");
 | 
						dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n");
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					out_invalid_transport_udp:
 | 
				
			||||||
 | 
						dfprintk(MOUNT, "NFSv4: Unsupported transport protocol udp\n");
 | 
				
			||||||
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue