Commit 88dee0cc authored by Trond Myklebust's avatar Trond Myklebust

NFS: Ensure rpc_run_task() cannot fail in nfs_async_rename()

Ensure the call to rpc_run_task() cannot fail by preallocating the
rpc_task.

Fixes: 910ad386 ("NFS: Fix memory allocation in rpc_alloc_task()")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 68b78dcd
...@@ -347,6 +347,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir, ...@@ -347,6 +347,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
data = kzalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data == NULL) if (data == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
task_setup_data.task = &data->task;
task_setup_data.callback_data = data; task_setup_data.callback_data = data;
data->cred = get_current_cred(); data->cred = get_current_cred();
......
...@@ -1694,6 +1694,7 @@ struct nfs_unlinkdata { ...@@ -1694,6 +1694,7 @@ struct nfs_unlinkdata {
struct nfs_renamedata { struct nfs_renamedata {
struct nfs_renameargs args; struct nfs_renameargs args;
struct nfs_renameres res; struct nfs_renameres res;
struct rpc_task task;
const struct cred *cred; const struct cred *cred;
struct inode *old_dir; struct inode *old_dir;
struct dentry *old_dentry; struct dentry *old_dentry;
......
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