提交 6e88e061 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

NFS: Verify server address before invoking in-kernel mount client

Re-order mount option sanity checking slightly to ensure we have a valid
server address *before* trying to do the mountd RPC call.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 113632d0
...@@ -1100,6 +1100,10 @@ static int nfs_validate_mount_data(void *options, ...@@ -1100,6 +1100,10 @@ static int nfs_validate_mount_data(void *options,
if (mntfh->size < sizeof(mntfh->data)) if (mntfh->size < sizeof(mntfh->data))
memset(mntfh->data + mntfh->size, 0, memset(mntfh->data + mntfh->size, 0,
sizeof(mntfh->data) - mntfh->size); sizeof(mntfh->data) - mntfh->size);
if (!nfs_verify_server_address((struct sockaddr *) &data->addr))
goto out_no_address;
/* /*
* Translate to nfs_parsed_mount_data, which nfs_fill_super * Translate to nfs_parsed_mount_data, which nfs_fill_super
* can deal with. * can deal with.
...@@ -1131,6 +1135,10 @@ static int nfs_validate_mount_data(void *options, ...@@ -1131,6 +1135,10 @@ static int nfs_validate_mount_data(void *options,
if (nfs_parse_mount_options((char *)options, args) == 0) if (nfs_parse_mount_options((char *)options, args) == 0)
return -EINVAL; return -EINVAL;
if (!nfs_verify_server_address((struct sockaddr *)
&args->nfs_server.address))
goto out_no_address;
c = strchr(dev_name, ':'); c = strchr(dev_name, ':');
if (c == NULL) if (c == NULL)
return -EINVAL; return -EINVAL;
...@@ -1159,10 +1167,6 @@ static int nfs_validate_mount_data(void *options, ...@@ -1159,10 +1167,6 @@ static int nfs_validate_mount_data(void *options,
goto out_v3_not_compiled; goto out_v3_not_compiled;
#endif /* !CONFIG_NFS_V3 */ #endif /* !CONFIG_NFS_V3 */
if (!nfs_verify_server_address((struct sockaddr *)
&args->nfs_server.address))
goto out_no_address;
return 0; return 0;
out_no_data: out_no_data:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册