Skip to content

Commit acc393a

Browse files
tititiou36gregkh
authored andcommitted
nfsd: Fix a memory leak in an error handling path
[ Upstream commit fd1ef88 ] If this memdup_user() call fails, the memory allocated in a previous call a few lines above should be freed. Otherwise it leaks. Fixes: 6ee95d1 ("nfsd: add support for upcall version 2") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent d7f1e7a commit acc393a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfsd/nfs4recover.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
825825
princhash.data = memdup_user(
826826
&ci->cc_princhash.cp_data,
827827
princhashlen);
828-
if (IS_ERR_OR_NULL(princhash.data))
828+
if (IS_ERR_OR_NULL(princhash.data)) {
829+
kfree(name.data);
829830
return -EFAULT;
831+
}
830832
princhash.len = princhashlen;
831833
} else
832834
princhash.len = 0;

0 commit comments

Comments
 (0)