[rh7] ploop: Fix the check that nobody writes to ZERO_PAGE()

Submitted by Konstantin Khorenko on Aug. 27, 2019, 9:33 a.m.

Details

Message ID 20190827093311.15355-1-khorenko@virtuozzo.com
State New
Series "ploop: Fix the check that nobody writes to ZERO_PAGE()"
Headers show

Commit Message

Konstantin Khorenko Aug. 27, 2019, 9:33 a.m.
The check must verify the destination page, not the source one.

Fixes: 3a44b99ce15e ("ploop: Check that nobody writes to ZERO_PAGE()")
https://jira.sw.ru/browse/PSBM-97043

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 drivers/block/ploop/dev.c       | 2 +-
 drivers/block/ploop/io_direct.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 6fb95f0fadb6..b6cb408347d2 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1583,7 +1583,7 @@  static void bio_bcopy(struct bio *dst, struct bio *src, struct ploop_device *plo
 		if (copy > PAGE_SIZE - poff)
 			copy = PAGE_SIZE - poff;
 
-		WARN_ON_ONCE(bv->bv_page == ZERO_PAGE(0));
+		WARN_ON_ONCE(dst->bi_io_vec[didx].bv_page == ZERO_PAGE(0));
 		ksrc = kmap_atomic(bv->bv_page);
 		memcpy(page_address(dst->bi_io_vec[didx].bv_page) + poff,
 		       ksrc + bv->bv_offset + bv_off,
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 6b4fd667ff71..6a5df39b3030 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -348,7 +348,7 @@  static void bcopy_from_blist(struct page *page, int dst_off, /* dst */
 		u8 *ksrc;
 		int copy = MIN(copy_len, biter->bv->bv_len - biter->off);
 
-		WARN_ON_ONCE(biter->bv->bv_page == ZERO_PAGE(0));
+		WARN_ON_ONCE(page == ZERO_PAGE(0));
 		ksrc = kmap_atomic(biter->bv->bv_page);
 		memcpy(kdst + dst_off,
 		       ksrc + biter->bv->bv_offset + biter->off,