Skip to content

Commit 88dee0c

Browse files
author
Trond Myklebust
committed
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: 910ad38 ("NFS: Fix memory allocation in rpc_alloc_task()") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 68b78dc commit 88dee0c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

fs/nfs/unlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
347347
data = kzalloc(sizeof(*data), GFP_KERNEL);
348348
if (data == NULL)
349349
return ERR_PTR(-ENOMEM);
350+
task_setup_data.task = &data->task;
350351
task_setup_data.callback_data = data;
351352

352353
data->cred = get_current_cred();

include/linux/nfs_xdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,7 @@ struct nfs_unlinkdata {
16941694
struct nfs_renamedata {
16951695
struct nfs_renameargs args;
16961696
struct nfs_renameres res;
1697+
struct rpc_task task;
16971698
const struct cred *cred;
16981699
struct inode *old_dir;
16991700
struct dentry *old_dentry;

0 commit comments

Comments
 (0)