mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
nfsd: check get_user() return when reading princhashlen
In __cld_pipe_inprogress_downcall(), the get_user() that reads
princhashlen from the userspace cld_msg_v2 buffer does not check its
return value. A failing copy leaves princhashlen with uninitialised
stack contents, which are then used to drive memdup_user() and stored
as princhash.len on the resulting reclaim record. The other get_user()
calls in this function all check the return; only this one is missed,
which is most likely a copy-paste oversight from when v2 upcalls were
introduced.
Mirror the existing pattern used a few lines above for namelen.
namecopy is declared with __free(kfree) so the early return cleans up
the already-allocated buffer automatically.
Fixes: 6ee95d1c89 ("nfsd: add support for upcall version 2")
Cc: stable@vger.kernel.org
Signed-off-by: Dominik Woźniak <stalion@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
0150459b05
commit
e186fa1c05
|
|
@ -718,7 +718,8 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
|
|||
return PTR_ERR(namecopy);
|
||||
name.data = namecopy;
|
||||
name.len = namelen;
|
||||
get_user(princhashlen, &ci->cc_princhash.cp_len);
|
||||
if (get_user(princhashlen, &ci->cc_princhash.cp_len))
|
||||
return -EFAULT;
|
||||
if (princhashlen > 0) {
|
||||
princhashcopy = memdup_user(
|
||||
&ci->cc_princhash.cp_data,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user