Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282933
b: refs/heads/master
c: 8a0d551
h: refs/heads/master
i:
  282931: 5dc43eb
v: v3
  • Loading branch information
Jeff Layton authored and Trond Myklebust committed Jan 5, 2012
1 parent c9f7868 commit 9c77239
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2edb6bc3852c681c0d948245bd55108dc6407604
refs/heads/master: 8a0d551a59ac92d8ff048d6cb29d3a02073e81e8
43 changes: 19 additions & 24 deletions trunk/fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,24 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int ve
data->auth_flavor_len = 1;
data->version = version;
data->minorversion = 0;
security_init_mnt_opts(&data->lsm_opts);
}
return data;
}

static void nfs_free_parsed_mount_data(struct nfs_parsed_mount_data *data)
{
if (data) {
kfree(data->client_address);
kfree(data->mount_server.hostname);
kfree(data->nfs_server.export_path);
kfree(data->nfs_server.hostname);
kfree(data->fscache_uniq);
security_free_mnt_opts(&data->lsm_opts);
kfree(data);
}
}

/*
* Sanity-check a server address provided by the mount command.
*
Expand Down Expand Up @@ -2220,9 +2234,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
data = nfs_alloc_parsed_mount_data(NFS_DEFAULT_VERSION);
mntfh = nfs_alloc_fhandle();
if (data == NULL || mntfh == NULL)
goto out_free_fh;

security_init_mnt_opts(&data->lsm_opts);
goto out;

/* Validate the mount data */
error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name);
Expand All @@ -2234,8 +2246,6 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
#ifdef CONFIG_NFS_V4
if (data->version == 4) {
mntroot = nfs4_try_mount(flags, dev_name, data);
kfree(data->client_address);
kfree(data->nfs_server.export_path);
goto out;
}
#endif /* CONFIG_NFS_V4 */
Expand Down Expand Up @@ -2290,13 +2300,8 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
s->s_flags |= MS_ACTIVE;

out:
kfree(data->nfs_server.hostname);
kfree(data->mount_server.hostname);
kfree(data->fscache_uniq);
security_free_mnt_opts(&data->lsm_opts);
out_free_fh:
nfs_free_parsed_mount_data(data);
nfs_free_fhandle(mntfh);
kfree(data);
return mntroot;

out_err_nosb:
Expand Down Expand Up @@ -2623,9 +2628,7 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,

mntfh = nfs_alloc_fhandle();
if (data == NULL || mntfh == NULL)
goto out_free_fh;

security_init_mnt_opts(&data->lsm_opts);
goto out;

/* Get a volume representation */
server = nfs4_create_server(data, mntfh);
Expand Down Expand Up @@ -2677,13 +2680,10 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,

s->s_flags |= MS_ACTIVE;

security_free_mnt_opts(&data->lsm_opts);
nfs_free_fhandle(mntfh);
return mntroot;

out:
security_free_mnt_opts(&data->lsm_opts);
out_free_fh:
nfs_free_fhandle(mntfh);
return ERR_PTR(error);

Expand Down Expand Up @@ -2838,7 +2838,7 @@ static struct dentry *nfs4_mount(struct file_system_type *fs_type,

data = nfs_alloc_parsed_mount_data(4);
if (data == NULL)
goto out_free_data;
goto out;

/* Validate the mount data */
error = nfs4_validate_mount_data(raw_data, data, dev_name);
Expand All @@ -2852,12 +2852,7 @@ static struct dentry *nfs4_mount(struct file_system_type *fs_type,
error = PTR_ERR(res);

out:
kfree(data->client_address);
kfree(data->nfs_server.export_path);
kfree(data->nfs_server.hostname);
kfree(data->fscache_uniq);
out_free_data:
kfree(data);
nfs_free_parsed_mount_data(data);
dprintk("<-- nfs4_mount() = %d%s\n", error,
error != 0 ? " [error]" : "");
return res;
Expand Down

0 comments on commit 9c77239

Please sign in to comment.