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 0F74038644F; Sat, 17 Oct 2026 16:37:50 +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=1792255071; cv=none; b=hp5RI1HtPidY+YfBaAtSWVf6UwwPqW0/b0+z8aHtIqpk9fXzW5ZmtITwzSCTcafcyQmNC6TkII3rd5N5VglobS/0IsnrgmEJbSg8jc/QkmvvV+hYW0cWub3oTNqEn4P2eHqaO18e5L0MW/5lvMYAL+SIY5lsc91syuVWb4pWyCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792255071; c=relaxed/simple; bh=4dzblmcpo1dmQPwVrZ9GBYUlsWVNBR8aZAgunEdsvGM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cIr38rm3iRU7DABb46zxhMZpT9ViXdTKL4XQ+THfTF0YiXRZ6ReS6WZF2u+e8XBtTVs60B1kNXO/7jCZHW/vJEgTSaVn3xV5NRRNt7jWRnFzjVE09rk08rFSoBiDv/5/r55p82kjSSAlSu7IwuPHIIZJUcPTw4VQQ8QsgSlMaRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Sr7fh00c; 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="Sr7fh00c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 599381F000C4; Sat, 17 Oct 2026 16:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792255070; bh=DK5c3RQdRjL+tYAyFZznaQFVbfps8fa1SGGYWTj7SoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Sr7fh00cg4QfikzihDS4tE9+LNtxC2TQnQ13Nhrp1QgJpPfPDMDMCQH7zsBwJI0/h /GyaGgiOY20eWy9J64oOtls03PQPl5lIuZQVc2B+Xc+LeWpVVRbmvAliE67uCEQQZz j+XZRHnfZjOpcOudoeQEggM990/pEjUH945KNfcc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= , Trond Myklebust , Sasha Levin Subject: [PATCH 6.12 609/869] NFSv4.1: zero referring call lists before decoding Date: Sat, 17 Oct 2026 17:57:30 +0200 Message-ID: <20261017160052.654777054@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160036.979869304@linuxfoundation.org> References: <20261017160036.979869304@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jérémy Jean [ Upstream commit 8fa4804fe62ca4155a2d8fc2789d630376cbf2fc ] decode_cb_sequence_args() allocates csa_rclists with kmalloc_objs(), so each referring_call_list starts uninitialized. decode_rc_list() assigns rcl_refcalls only when rcl_nrefcalls is nonzero. A valid list with zero referring calls therefore leaves the pointer uninitialized, and nfs4_callback_sequence() later passes stale slab contents to kfree(). Allocate csa_rclists with kzalloc_objs() so every rcl_refcalls member is NULL from the beginning, including valid empty referring call lists. Fixes: 4aece6a19cf7 ("nfs41: cb_sequence xdr implementation") Assisted-by: Codex:gpt-5 Signed-off-by: Jérémy Jean Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/callback_xdr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 4254ba3ee7c57..ada04a7230c22 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -422,9 +422,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, args->csa_nrclists = ntohl(*p++); args->csa_rclists = NULL; if (args->csa_nrclists) { - args->csa_rclists = kmalloc_array(args->csa_nrclists, - sizeof(*args->csa_rclists), - GFP_KERNEL); + args->csa_rclists = kcalloc(args->csa_nrclists, + sizeof(*args->csa_rclists), + GFP_KERNEL); if (unlikely(args->csa_rclists == NULL)) return htonl(NFS4ERR_RESOURCE); -- 2.53.0