Skip to content

Commit 0439f31

Browse files
Dan CarpenterTrond Myklebust
authored andcommitted
NFSv4.1: integer overflow in decode_cb_sequence_args()
This seems like it could overflow on 32 bits. Use kmalloc_array() which has overflow protection built in. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 92123e0 commit 0439f31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/nfs/callback_xdr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
455455
args->csa_nrclists = ntohl(*p++);
456456
args->csa_rclists = NULL;
457457
if (args->csa_nrclists) {
458-
args->csa_rclists = kmalloc(args->csa_nrclists *
459-
sizeof(*args->csa_rclists),
460-
GFP_KERNEL);
458+
args->csa_rclists = kmalloc_array(args->csa_nrclists,
459+
sizeof(*args->csa_rclists),
460+
GFP_KERNEL);
461461
if (unlikely(args->csa_rclists == NULL))
462462
goto out;
463463

0 commit comments

Comments
 (0)