From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A5E031DD97; Thu, 2 Jul 2026 16:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011442; cv=none; b=fy4c9cYZOU4ZtT5PxwMcUUq6zLthSNHGVfJHRCmZPCj7ozRDLSniyXDl4d5eBiTjACT57UNGlnMeFX7Q6zOQKnt3nHMkZo/n8GO+LB+2NSpWJinXJouC9mDaoIRUlEMSwPYCzS0bSByDYdbLz7g5iaX3IK8oufZlB+tcv9TlPHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011442; c=relaxed/simple; bh=jT/+QVoLfbVNIIjM9KRqgdN7q0FsR30Eo6n0tbbJ8vM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X2xtWsu5PZsIFABq2GSReFp/LCtiE8YLQLG02TsYehgo+0w+W8BylZpNSGhHBY34hgsVqw8EQPotTbDkcKMqxI83dUgWLWR5tt0wnOZtnOqdGK/M+5b0CtoSW46pkG8N42Ye8GnmQhzsEzIky0gpEyMKVCfDz7lgxA489teRsV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FCy44Boh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FCy44Boh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9197C1F000E9; Thu, 2 Jul 2026 16:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783011441; bh=4ZBaz8MVtQ+IO9N6vIGnF60KYEzrne5qjjwgQwzax3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FCy44BohTGgKPt9NMn5uudFHEjF/GRKelSA4B1yVUPUbAkVwmcMut3ZJtDkhRQS9a R9CaZ26bQRNhvPXwVsD062Y+qUnGQoyqLWgWqHnQOjDxxG43kYPvmlz+9VqN9BD/W3 rT7IFxq62ojxC+s/+Q8HAT/5C6EyrUO6EUzIInZ0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Dominik=20Wo=C5=BAniak?= , Jeff Layton , Chuck Lever Subject: [PATCH 6.18 098/108] nfsd: check get_user() return when reading princhashlen Date: Thu, 2 Jul 2026 18:21:35 +0200 Message-ID: <20260702155114.143730729@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155112.110058792@linuxfoundation.org> References: <20260702155112.110058792@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dominik Woźniak commit e186fa1c057f5eccb22afb1e83e34c0627085868 upstream. 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: 6ee95d1c8991 ("nfsd: add support for upcall version 2") Cc: stable@vger.kernel.org Signed-off-by: Dominik Woźniak Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4recover.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -800,7 +800,8 @@ __cld_pipe_inprogress_downcall(const str if (IS_ERR(name.data)) return PTR_ERR(name.data); 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) { princhash.data = memdup_user( &ci->cc_princhash.cp_data,