[Devel] [PATCH rh7 v2] ploop: Fix the check that nobody writes to ZERO_PAGE()
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Aug 27 12:39:08 MSK 2019
On 27.08.2019 12:38, Konstantin Khorenko wrote:
> 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 at virtuozzo.com>
Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>
> --
> v2: move the check in bcopy_from_blist() out of the cycle
> ---
> drivers/block/ploop/dev.c | 2 +-
> drivers/block/ploop/io_direct.c | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> 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..1beb4f3292a2 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -344,11 +344,12 @@ static void bcopy_from_blist(struct page *page, int dst_off, /* dst */
> {
> u8 *kdst = kmap_atomic(page);
>
> + WARN_ON_ONCE(page == ZERO_PAGE(0));
> +
> while (copy_len > 0) {
> u8 *ksrc;
> int copy = MIN(copy_len, biter->bv->bv_len - biter->off);
>
> - WARN_ON_ONCE(biter->bv->bv_page == ZERO_PAGE(0));
> ksrc = kmap_atomic(biter->bv->bv_page);
> memcpy(kdst + dst_off,
> ksrc + biter->bv->bv_offset + biter->off,
>
More information about the Devel
mailing list