Commit fd1ef880 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Chuck Lever

nfsd: Fix a memory leak in an error handling path

If this memdup_user() call fails, the memory allocated in a previous call
a few lines above should be freed. Otherwise it leaks.

Fixes: 6ee95d1c ("nfsd: add support for upcall version 2")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 4ab3442c
...@@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, ...@@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
princhash.data = memdup_user( princhash.data = memdup_user(
&ci->cc_princhash.cp_data, &ci->cc_princhash.cp_data,
princhashlen); princhashlen);
if (IS_ERR_OR_NULL(princhash.data)) if (IS_ERR_OR_NULL(princhash.data)) {
kfree(name.data);
return -EFAULT; return -EFAULT;
}
princhash.len = princhashlen; princhash.len = princhashlen;
} else } else
princhash.len = 0; princhash.len = 0;
......
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