Staging: comedi: integer overflow in do_insnlist_ioctl()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Nov 2011 18:20:43 +0000 (21:20 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 27 Nov 2011 02:34:15 +0000 (18:34 -0800)
commite384a41141949843899affcf51f4e6e646c1fe9f
tree402bbdb1c4d89e0fb354d168da2ac56332ecfd79
parent6a9ce6b654e491981f6ef7e214cbd4f63e033848
Staging: comedi: integer overflow in do_insnlist_ioctl()

There is an integer overflow here that could cause memory corruption
on 32 bit systems.

insnlist.n_insns could be a very high value size calculation for
kmalloc() could overflow resulting in a smaller "insns" than
expected.  In the for (i = 0; i < insnlist.n_insns; i++) {... loop
we would read past the end of the buffer, possibly corrupting memory
as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/comedi_fops.c