mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 14:04:27 -04:00
NFSv4.1: zero referring call lists before decoding
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: 4aece6a19c ("nfs41: cb_sequence xdr implementation")
Assisted-by: Codex:gpt-5
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
committed by
Trond Myklebust
parent
10f307e525
commit
8fa4804fe6
@@ -417,7 +417,7 @@ 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_objs(*args->csa_rclists,
|
||||
args->csa_rclists = kzalloc_objs(*args->csa_rclists,
|
||||
args->csa_nrclists);
|
||||
if (unlikely(args->csa_rclists == NULL))
|
||||
return htonl(NFS4ERR_RESOURCE);
|
||||
|
||||
Reference in New Issue
Block a user