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 69C6E3446A7; Thu, 2 Jul 2026 16:52:03 +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=1783011124; cv=none; b=Tf533QFSPZ37/6Sx9h8EFNXpYkIktw1Nker3hMihLmOH8BBalc3j3ptlBSokXtxTyeD4VzyJTTCWzClDZ+ItXnA3tXVScK5DCeNAk0M5UPyERriyWNkmiv8phpGk8SzzwbM8lKnIMxSunH4YRZGNKSIdkCbbd1TqEDqUawPj5qA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011124; c=relaxed/simple; bh=zZu2GNK+e8k/iSPwRIeE5wUOhWULAJ9s7Kmit8bKplM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zgo6IxqTLHQ69lXMTKCu7HRpmoAeiAoEFyQ9+zgtodZfIicRT+lRS7yDk1rGDIRGuXrYRbVNJRr5vE3AaBBlH8kmp+E9A7Oe7vVGxLbWWFQyDzSgD+11GdW/9cnAnPwvWfdeyUFzp5G32bxgCZsbXhW1iNFD+pA0sSrtDT691rI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eM/PYik1; 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="eM/PYik1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF0951F000E9; Thu, 2 Jul 2026 16:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783011123; bh=/MaRaMAndue6PuVL6ykvt84XF/AFb8WV1pQ5MIT7umw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eM/PYik1GnRjmnDxbdS+lZWn+aXp5RQFxTquTlkn5qYo3xn8Kir98ziB3GeND5G2A elvu7r73vJmCQ3PM19Yp8trMNRI6G+TJbwFz3UqwsoZilZhKthVxaUv8EBvSMrBNZz 69SQKIU7lj4mdO+7xrEb4lwiVG3JzCMl1RsxruFw= 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.6 165/175] nfsd: check get_user() return when reading princhashlen Date: Thu, 2 Jul 2026 18:21:06 +0200 Message-ID: <20260702155119.265392683@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155115.766838875@linuxfoundation.org> References: <20260702155115.766838875@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.6-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 @@ -815,7 +815,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,