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 20A213876CC; Fri, 4 Sep 2026 05:45:56 +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=1788500758; cv=none; b=tsKYdyswly67jJZWatDjWdnn+Q/NxWqRnOJUdRFw0b9jtEX5mSsiFuvH9RI5W4pTla/ZGuFRCTjKvtjVNYF4dqeXvUhignBRPsHcsWWTDvKDnjLb57zWp2hKM1UllEtmcUjjnI/7ybLFzptFZELP/O9O/p61TGP+IFBM1rkpqa0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788500758; c=relaxed/simple; bh=t8+L26/cDqMPp5CRQ3xZ/RamsqoQq1Y+mCDh4T4hnYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vj5F5SeZseTK1eDGQnB6Q6KyUX9LekvOW8KNDnMdbCQo2GTcRlLXymh4vxpRLEbb3ofYfFoYKnq/P5PKe7+P0nxExvM6tbIWnmKHPY2xsMVN/VAq0pr8B0y7clBWz4+cDiWklkHS86qAHh3usjoUeXhVDx/zTnFo/tJDHImi4Jc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u9sD35Xr; 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="u9sD35Xr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CAF41F00A3D; Fri, 4 Sep 2026 05:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788500756; bh=X3Etm3hkryWALTH5Iey3U3Hqu/pTRzpE66DOlGluZKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=u9sD35XrtGQJy0r1R/xM+nG7QVbCiJ3mpwz8gLoibp5D/rTpCkoM04VTANHPhBgn8 STiqiwFMbeKZZly6LFP2iI383VT3Adh6ZMR16cjl8YdBem+PcIFHAvJw05wDkxw0tu bAZ5aRkm17jspgOgFZ95vpBH6v9pwzxT2IUCrFH8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chris Mason , Jeff Layton , Chuck Lever Subject: [PATCH 6.18 116/552] nfsd: validate symlink target length in NFSv4 CREATE Date: Fri, 4 Sep 2026 06:54:33 +0200 Message-ID: <20260904045750.591559824@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045747.813364717@linuxfoundation.org> References: <20260904045747.813364717@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Layton commit 041f57056e5fb9c80adc088269322d2c61074406 upstream. nfsd4_decode_create() accepts an unbounded cr_datalen from the wire for NF4LNK symlink targets, allowing a client to force a kmalloc of up to the maximum RPC payload size (several MiB) per COMPOUND op that persists until compound teardown. The VFS rejects oversized targets with ENAMETOOLONG, but the allocation has already occurred. Reject cr_datalen == 0 early with nfserr_inval and cr_datalen greater than NFS4_MAXPATHLEN (PATH_MAX) with nfserr_nametoolong to bound the allocation. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Assisted-by: kres:claude-opus-4-7 Reported-by: Chris Mason Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260530-nfsd-fixes-v2-9-f27e8eb4d974@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4xdr.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -826,6 +826,10 @@ nfsd4_decode_create(struct nfsd4_compoun case NF4LNK: if (xdr_stream_decode_u32(argp->xdr, &create->cr_datalen) < 0) return nfserr_bad_xdr; + if (create->cr_datalen == 0) + return nfserr_inval; + if (create->cr_datalen > NFS4_MAXPATHLEN) + return nfserr_nametoolong; p = xdr_inline_decode(argp->xdr, create->cr_datalen); if (!p) return nfserr_bad_xdr;