zram: avoid access beyond the zram device
authorJiang Liu <liuj97@gmail.com>
Thu, 6 Jun 2013 16:07:26 +0000 (00:07 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 27 Jul 2013 04:34:07 +0000 (05:34 +0100)
commit624d1705fa1d6e4c647ca5859ecd921748bd85bf
tree25f71ea8527041fc970c8d28f614188f5b6e722e
parent29c303b89a1bc8f1704ffd4c58308781c9f8f844
zram: avoid access beyond the zram device

commit 12a7ad3b810e77137d0caf97a6dd97591e075b30 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/staging/zram/zram_drv.c