android_kernel_motorola_sm6225/drivers/block
Weijie Yang 38515c7339 zram: correct offset usage in zram_bio_discard
We want to skip the physical block(PAGE_SIZE) which is partially covered
by the discard bio, so we check the remaining size and subtract it if
there is a need to goto the next physical block.

The current offset usage in zram_bio_discard is incorrect, it will cause
its upper filesystem breakdown.  Consider the following scenario:

On some architecture or config, PAGE_SIZE is 64K for example, filesystem
is set up on zram disk without PAGE_SIZE aligned, a discard bio leads to a
offset = 4K and size=72K, normally, it should not really discard any
physical block as it partially cover two physical blocks.  However, with
the current offset usage, it will discard the second physical block and
free its memory, which will cause filesystem breakdown.

This patch corrects the offset usage in zram_bio_discard.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-04 16:54:13 -07:00
..
aoe mm: close PageTail race 2014-03-04 07:55:47 -08:00
drbd drbd: use list_first_entry_or_null in first_peer_device/first_connection 2014-04-30 13:46:56 -06:00
mtip32xx Merge branch 'for-3.16/core' into for-3.16/drivers 2014-05-30 08:11:50 -06:00
paride block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
rsxx block: Convert bio_for_each_segment() to bvec_iter 2013-11-23 22:33:49 -08:00
xen-blkback xen-blkback: defer freeing blkif to avoid blocking xenwatch 2014-05-28 14:17:32 -04:00
zram zram: correct offset usage in zram_bio_discard 2014-06-04 16:54:13 -07:00
amiflop.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
ataflop.c Merge branch 'for-3.16/core' of git://git.kernel.dk/linux-block into next 2014-06-02 09:29:34 -07:00
brd.c brd: return -ENOSPC rather than -ENOMEM on page allocation failure 2014-06-04 16:54:02 -07:00
cciss.c cciss: Use pci_enable_msix_exact() instead of pci_enable_msix() 2014-04-21 19:02:08 -06:00
cciss.h
cciss_cmd.h
cciss_scsi.c cciss: switch to ->show_info() 2013-04-09 14:13:19 -04:00
cciss_scsi.h
cpqarray.c cpqarray: fix info leak in ida_locked_ioctl() 2013-09-24 17:00:26 -07:00
cpqarray.h
cryptoloop.c move linux/loop.h to drivers/block 2013-06-29 12:46:45 +04:00
DAC960.c DAC960: remove sleep_on usage 2014-03-13 14:56:38 -06:00
DAC960.h
floppy.c Merge branch 'for-3.16/drivers' of git://git.kernel.dk/linux-block into next 2014-06-02 13:57:01 -07:00
hd.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
ida_cmd.h
ida_ioctl.h
Kconfig zram: promote zram from staging 2014-01-30 16:56:55 -08:00
loop.c Merge branch 'sched/urgent' into sched/core, to avoid conflicts 2014-05-07 13:15:46 +02:00
loop.h move linux/loop.h to drivers/block 2013-06-29 12:46:45 +04:00
Makefile zram: promote zram from staging 2014-01-30 16:56:55 -08:00
mg_disk.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
nbd.c Merge branch 'sched/urgent' into sched/core, to avoid conflicts 2014-05-07 13:15:46 +02:00
null_blk.c Merge branch 'for-3.16/core' into for-3.16/drivers 2014-05-28 10:18:51 -06:00
nvme-core.c NVMe: Implement PCIe reset notification callback 2014-05-27 11:12:29 -06:00
nvme-scsi.c NVMe: Retry failed commands with non-fatal errors 2014-04-10 17:11:59 -04:00
osdblk.c block: replace strict_strtoul() with kstrtoul() 2013-09-11 15:56:56 -07:00
pktcdvd.c sched, treewide: Replace hardcoded nice values with MIN_NICE/MAX_NICE 2014-04-18 12:07:24 +02:00
ps3disk.c block: Kill bio_segments()/bi_vcnt usage 2013-11-23 22:33:51 -08:00
ps3vram.c block: Convert bio_for_each_segment() to bvec_iter 2013-11-23 22:33:49 -08:00
rbd.c rbd: prefix rbd writes with CEPH_OSD_OP_SETALLOCHINT osd op 2014-04-03 10:33:52 +08:00
rbd_types.h
skd_main.c Merge branch 'for-3.16/core' into for-3.16/drivers 2014-05-28 09:50:26 -06:00
skd_s1120.h skd: fix formatting in skd_s1120.h 2013-11-08 09:10:30 -07:00
smart1,2.h
sunvdc.c
swim.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
swim3.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
swim_asm.S
sx8.c drivers/block/sx8.c: remove unnecessary pci_set_drvdata() 2014-01-21 20:16:56 -08:00
umem.c block: Convert drivers to immutable biovecs 2013-11-23 22:33:51 -08:00
umem.h
virtio_blk.c Merge branch 'for-3.16/core' of git://git.kernel.dk/linux-block into next 2014-06-02 09:29:34 -07:00
xen-blkfront.c Merge branch 'stable/for-jens-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip into for-3.16/drivers 2014-05-28 12:37:04 -06:00
xsysace.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00
z2ram.c block: remove struct request buffer member 2014-04-15 14:03:02 -06:00