Skip to content

Commit 49a3613

Browse files
daimngoJ. Bruce Fields
authored andcommitted
NFSD: fix missing refcount in nfsd4_copy by nfsd4_do_async_copy
Need to initialize nfsd4_copy's refcount to 1 to avoid use-after-free warning when nfs4_put_copy is called from nfsd4_cb_offload_release. Fixes: ce0887a ("NFSD add nfs4 inter ssc to nfsd4_copy") Signed-off-by: Dai Ngo <dai.ngo@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 36e1e5b commit 49a3613

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/nfsd/nfs4proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ static int nfsd4_do_async_copy(void *data)
14861486
cb_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL);
14871487
if (!cb_copy)
14881488
goto out;
1489+
refcount_set(&cb_copy->refcount, 1);
14891490
memcpy(&cb_copy->cp_res, &copy->cp_res, sizeof(copy->cp_res));
14901491
cb_copy->cp_clp = copy->cp_clp;
14911492
cb_copy->nfserr = copy->nfserr;

0 commit comments

Comments
 (0)