Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 5c88a9d

Browse files
trondmypdgregkh
authored andcommitted
NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args
commit d8ba1f9 upstream. If the call to decode_rc_list() fails due to a memory allocation error, then we need to truncate the array size to ensure that we only call kfree() on those pointer that were allocated. Reported-by: David Ramos <[email protected]> Fixes: 4aece6a ("nfs41: cb_sequence xdr implementation") Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2c679cb commit 5c88a9d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfs/callback_xdr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
464464

465465
for (i = 0; i < args->csa_nrclists; i++) {
466466
status = decode_rc_list(xdr, &args->csa_rclists[i]);
467-
if (status)
467+
if (status) {
468+
args->csa_nrclists = i;
468469
goto out_free;
470+
}
469471
}
470472
}
471473
status = 0;

0 commit comments

Comments
 (0)