Commit 20c71f5e authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix a bug in nfs4_validate_mount_data()

The previous patch introduced a bug when copying the server address.

Also clarify a copy into the auth_flavours array: currently the two
size calculations are equivalent, but we may decide to change the size
of auth_flavors[] at some point.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 91ea40b9
...@@ -1541,7 +1541,7 @@ static int nfs4_validate_mount_data(void *options, ...@@ -1541,7 +1541,7 @@ static int nfs4_validate_mount_data(void *options,
goto out_no_address; goto out_no_address;
if (copy_from_user(&args->nfs_server.address, if (copy_from_user(&args->nfs_server.address,
data->host_addr, data->host_addr,
sizeof(&args->nfs_server.address))) sizeof(args->nfs_server.address)))
return -EFAULT; return -EFAULT;
if (args->nfs_server.address.sin_port == 0) if (args->nfs_server.address.sin_port == 0)
args->nfs_server.address.sin_port = htons(NFS_PORT); args->nfs_server.address.sin_port = htons(NFS_PORT);
...@@ -1554,9 +1554,9 @@ static int nfs4_validate_mount_data(void *options, ...@@ -1554,9 +1554,9 @@ static int nfs4_validate_mount_data(void *options,
args->auth_flavors[0] = RPC_AUTH_UNIX; args->auth_flavors[0] = RPC_AUTH_UNIX;
break; break;
case 1: case 1:
if (copy_from_user(args->auth_flavors, if (copy_from_user(&args->auth_flavors[0],
data->auth_flavours, data->auth_flavours,
sizeof(args->auth_flavors))) sizeof(args->auth_flavors[0])))
return -EFAULT; return -EFAULT;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment