From: Dan Carpenter Date: Tue, 12 Jun 2012 07:37:08 +0000 (+0300) Subject: NFSv4.1: integer overflow in decode_cb_sequence_args() X-Git-Tag: v3.4.92~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42b607da2d04e91439ba58d263e90a70d0243388;p=platform%2Fkernel%2Flinux-stable.git NFSv4.1: integer overflow in decode_cb_sequence_args() commit 0439f31c35d1da0b28988b308ea455e38e6a350d upstream. This seems like it could overflow on 32 bits. Use kmalloc_array() which has overflow protection built in. Signed-off-by: Dan Carpenter Signed-off-by: Trond Myklebust Signed-off-by: Ben Hutchings Cc: Rui Xiang Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 95bfc24..27c2969 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -455,9 +455,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(args->csa_nrclists * - sizeof(*args->csa_rclists), - GFP_KERNEL); + args->csa_rclists = kmalloc_array(args->csa_nrclists, + sizeof(*args->csa_rclists), + GFP_KERNEL); if (unlikely(args->csa_rclists == NULL)) goto out;