]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Ensure rpc_run_task() cannot fail in nfs_async_rename()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 7 Apr 2022 02:34:35 +0000 (22:34 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 7 Apr 2022 20:20:00 +0000 (16:20 -0400)
Ensure the call to rpc_run_task() cannot fail by preallocating the
rpc_task.

Fixes: ec7b96672dbd ("NFS: Fix memory allocation in rpc_alloc_task()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/unlink.c
include/linux/nfs_xdr.h

index 5fa11e1aca4c2759358aa37c7c36691c1bc4bcd4..6f325e10056cebecf767d4a988715c1d5b58737c 100644 (file)
@@ -347,6 +347,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
        data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return ERR_PTR(-ENOMEM);
+       task_setup_data.task = &data->task;
        task_setup_data.callback_data = data;
 
        data->cred = get_current_cred();
index 49ba486aea5fd831f707ed3bc5153814bbe394c0..2863e5a69c6abdd208284c0238d135f297037b9f 100644 (file)
@@ -1694,6 +1694,7 @@ struct nfs_unlinkdata {
 struct nfs_renamedata {
        struct nfs_renameargs   args;
        struct nfs_renameres    res;
+       struct rpc_task         task;
        const struct cred       *cred;
        struct inode            *old_dir;
        struct dentry           *old_dentry;