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

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
				princhash.data = memdup_user(
						&ci->cc_princhash.cp_data,
						princhashlen);
				if (IS_ERR_OR_NULL(princhash.data))
				if (IS_ERR_OR_NULL(princhash.data)) {
					kfree(name.data);
					return -EFAULT;
				}
				princhash.len = princhashlen;
			} else
				princhash.len = 0;