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 B3488358378; Fri, 4 Sep 2026 06:08:05 +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=1788502086; cv=none; b=kLDzjU5K3ud5DqWiTf3WveHCz63155qXXz5UdS+q3yQc0IX8f6Wp12VDXDnBechObrpIRHR8/6hXPvL1uayVcPHfxYWkpDEqEISxd+To2aJpNz48bAxOgZdl5R6z8+zNwZGufHXcXyTPStD5liaC60y9nim26iajaBQvLgDwEBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788502086; c=relaxed/simple; bh=z49NMFa+/r8NXgMkIPz3UPM8LWIRpf1wBfvZ45jSSNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rV2bc8yHk1DHWkesUUZ5fHkaVlb5t9seUwZ9SBSBwvJ12ZmlNLuJXdycARZBhf/I29Z4UUdoIMuA3go5ICc+JIuX9RpJHVE2rx4FQwsWOdm70lZL+JAbKdLC0GM7DDmdxGe3BVhwaJoBnly/30SjcU0AjpzozbW72ffB8wwd8Zw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yCv0QP8K; 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="yCv0QP8K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC86D1F00A3D; Fri, 4 Sep 2026 06:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788502085; bh=MEiqz9LUOFHfno+XzPFub4hDIKaBPFrX3dsVRhoXtJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yCv0QP8KeeLHVkxgoMTZ621M2sw6cU2vpva5zfKHVt/XLBMLjJG+Qo9M2jNlszqCX BOKsV+wVIB7KujGdeCwPpr9Ba+Kw4J1al9lySYVAGy/4+Hs4DhZbigDOtQ2xirGYRX RmZRNurd/rQhNCxy6sbgfNdXph1hTlZe/xUN3hsE= 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.12 082/403] nfsd: validate symlink target length in NFSv4 CREATE Date: Fri, 4 Sep 2026 06:58:05 +0200 Message-ID: <20260904045736.695544769@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 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 @@ -800,6 +800,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;