libceph: fix overflow in osdmap_decode()
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)
commit6b71f61c321b1fe8d35b75ab573ff46c51e59acc
tree8cf3da5771f2fb1d98fdaa84bde7ceeab4056630
parentc66a9c7c10955499d96df63ffd87feaee6b01754
libceph: fix overflow in osdmap_decode()

(cherry picked from commit e91a9b639a691e0982088b5954eaafb5a25c8f1c)

On 32-bit systems, a large `n' would overflow `n * sizeof(u32)' and bypass
the check ceph_decode_need(p, end, n * 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