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 A6D5630C160; Fri, 4 Sep 2026 06:08:42 +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=1788502123; cv=none; b=XCvmvBYVxKTyKHCBGlVQBUmRCNC3Fm80vTcyEWyQNVVerWwGlEV6d0C7UpuSItGmujgt4MYyPMhFwmMjqbw8+bI+8wJbwcCQK4AygS+PW0cFtDYz+3i5OK3qSmXX71cQfNdxMCoMtjdZ5f5cz4VvDKULwidPhR3jaGt0taPutTE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788502123; c=relaxed/simple; bh=TO1UQaUnzOhd99Ogrq4qqs/iQnZBHwkJtEthz/fmZ60=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iLf+ZVyB+Us3J2D+K0w3oV6qLWdKhv/PRaSn05QRD35haW3gE08uTrFAIxlJQR+xB0k66aLQgyyuaQnSGUn8JLnY2dFSd2gF57b53U++czI+fcjpNb0wC7JEsSgrRK/itmd/cbhyXNK4yw3AlFSUySoynnT1M+JLJ3YBCEMWmDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LtNY/beo; 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="LtNY/beo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F06D1F00A3D; Fri, 4 Sep 2026 06:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788502122; bh=R78msSGCqI3s7m2DCoICDWkcYYpco9G2LqxLYhmZmPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LtNY/beoWJVHnkTB+rvXAbZ3gLo3vjQUDEUkHZpbR3Hl4veLJUpn4OkFO7WhTCBFI ouXX+RBHP0qxCh7PncHh8GExl1mk+PK71Y4h9zxF9lMTIy4jfnW0D4INCb4QLH5x6u iRMJA++ZmJX0onseHoz4VU8sZ3wcnbZcGabb/gMA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jeff Layton , Chuck Lever Subject: [PATCH 6.12 098/403] nfsd: fix XDR padding calculation in ff_encode_getdeviceinfo Date: Fri, 4 Sep 2026 06:58:21 +0200 Message-ID: <20260904045737.063395535@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045734.806166532@linuxfoundation.org> References: <20260904045734.806166532@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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Layton commit 8b989aaec85e1293a871d602590c951fe44b8647 upstream. nfsd4_ff_encode_getdeviceinfo() computes the da_addr_body reservation as 16 + netid_len + addr_len, but the subsequent xdr_encode_opaque() calls emit 8 + round_up(netid_len, 4) + round_up(addr_len, 4) bytes. The mismatch means the declared da_addr_body length exceeds the actual encoded data by 2-8 bytes on every flexfile GETDEVICEINFO reply, leaking stale reply-page content to the client and mis-aligning the subsequent version list decode. Use xdr_align_size() for each string length to match what xdr_encode_opaque() actually writes. Fixes: efcae97fa425 ("NFSD: da_addr_body field missing in some GETDEVICEINFO replies") Cc: stable@vger.kernel.org Assisted-by: kres:claude-opus-4-6 Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260527-pnfs-fixes-v1-1-784f39dc1eca@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/flexfilelayoutxdr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/nfsd/flexfilelayoutxdr.c +++ b/fs/nfsd/flexfilelayoutxdr.c @@ -99,7 +99,8 @@ nfsd4_ff_encode_getdeviceinfo(struct xdr } /* len + padding for two strings */ - addr_len = 16 + da->netaddr.netid_len + da->netaddr.addr_len; + addr_len = 8 + xdr_align_size(da->netaddr.netid_len) + + xdr_align_size(da->netaddr.addr_len); ver_len = 20; len = 4 + ver_len + 4 + addr_len;