Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92935
b: refs/heads/master
c: 63649bd
h: refs/heads/master
i:
  92933: 9c9869f
  92931: a52c572
  92927: 10ba2ba
v: v3
  • Loading branch information
Cyrill Gorcunov authored and Trond Myklebust committed Apr 19, 2008
1 parent 5ec76d4 commit ab38d21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd019f7517206a74d8cdb64d5c82b1f76be608cc
refs/heads/master: 63649bd7080a6a50fabcb1935f4b7c4e64155066
16 changes: 16 additions & 0 deletions trunk/fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,8 @@ static int nfs_validate_mount_data(void *options,
args->namlen = data->namlen;
args->bsize = data->bsize;
args->auth_flavors[0] = data->pseudoflavor;
if (!args->nfs_server.hostname)
goto out_nomem;

/*
* The legacy version 6 binary mount data from userspace has a
Expand Down Expand Up @@ -1343,6 +1345,8 @@ static int nfs_validate_mount_data(void *options,
len = c - dev_name;
/* N.B. caller will free nfs_server.hostname in all cases */
args->nfs_server.hostname = kstrndup(dev_name, len, GFP_KERNEL);
if (!args->nfs_server.hostname)
goto out_nomem;

c++;
if (strlen(c) > NFS_MAXPATHLEN)
Expand Down Expand Up @@ -1386,6 +1390,10 @@ static int nfs_validate_mount_data(void *options,
return -EPROTONOSUPPORT;
#endif /* !CONFIG_NFS_V3 */

out_nomem:
dfprintk(MOUNT, "NFS: not enough memory to handle mount options\n");
return -ENOMEM;

out_no_address:
dfprintk(MOUNT, "NFS: mount program didn't pass remote address\n");
return -EINVAL;
Expand Down Expand Up @@ -1892,12 +1900,16 @@ static int nfs4_validate_mount_data(void *options,
return -ENAMETOOLONG;
/* N.B. caller will free nfs_server.hostname in all cases */
args->nfs_server.hostname = kstrndup(dev_name, len, GFP_KERNEL);
if (!args->nfs_server.hostname)
goto out_nomem;

c++; /* step over the ':' */
len = strlen(c);
if (len > NFS4_MAXPATHLEN)
return -ENAMETOOLONG;
args->nfs_server.export_path = kstrndup(c, len, GFP_KERNEL);
if (!args->nfs_server.export_path)
goto out_nomem;

dprintk("NFS: MNTPATH: '%s'\n", args->nfs_server.export_path);

Expand All @@ -1919,6 +1931,10 @@ static int nfs4_validate_mount_data(void *options,
data->auth_flavourlen);
return -EINVAL;

out_nomem:
dfprintk(MOUNT, "NFS4: not enough memory to handle mount options\n");
return -ENOMEM;

out_no_address:
dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n");
return -EINVAL;
Expand Down

0 comments on commit ab38d21

Please sign in to comment.