zram: avoid access beyond the zram device
authorJiang Liu <liuj97@gmail.com>
Thu, 6 Jun 2013 16:07:26 +0000 (00:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Jun 2013 19:12:20 +0000 (12:12 -0700)
commit12a7ad3b810e77137d0caf97a6dd97591e075b30
tree6eeed81f7990e9e78f4c98fb703a7a1cf022896f
parent65c484609a3b25c35e4edcd5f2c38f98f5226093
zram: avoid access beyond the zram device

Function valid_io_request() should verify the entire request are within
the zram device address range. Otherwise it may cause invalid memory
access when accessing/modifying zram->meta->table[index] because the
'index' is out of range. Then it may access non-exist memory, randomly
modify memory belong to other subsystems, which is hard to track down.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/zram/zram_drv.c