libceph: fix overflow in osdmap_apply_incremental()
authorXi Wang <xi.wang@gmail.com>
Thu, 7 Jun 2012 00:35:55 +0000 (19:35 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Nov 2012 19:38:24 +0000 (11:38 -0800)
commitf4d29a959aa619f3d46e2b685cfb8acac41503db
tree58c304c854c909c6143a2be3055353db624e3dc3
parent6b71f61c321b1fe8d35b75ab573ff46c51e59acc
libceph: fix overflow in osdmap_apply_incremental()

(cherry picked from commit a5506049500b30dbc5edb4d07a3577477c1f3643)

On 32-bit systems, a large `pglen' would overflow `pglen*sizeof(u32)'
and bypass the check ceph_decode_need(p, end, pglen*sizeof(u32), bad).
It would also overflow the subsequent kmalloc() size, leading to
out-of-bounds write.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ceph/osdmap.c