Skip to content

Commit

Permalink
vhost: correctly set bits of dirty pages
Browse files Browse the repository at this point in the history
Fix two bugs in dirty page logging:
When counting pages we should increase address by 1 instead of
VHOST_PAGE_SIZE. Make log_write() correctly process requests
that cross pages with write_address not starting at page boundary.

Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Nov 29, 2010
1 parent 11cd1a8 commit e4dde73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ static int log_write(void __user *log_base,
int r;
if (!write_length)
return 0;
write_length += write_address % VHOST_PAGE_SIZE;
write_address /= VHOST_PAGE_SIZE;
for (;;) {
u64 base = (u64)(unsigned long)log_base;
Expand All @@ -897,7 +898,7 @@ static int log_write(void __user *log_base,
if (write_length <= VHOST_PAGE_SIZE)
break;
write_length -= VHOST_PAGE_SIZE;
write_address += VHOST_PAGE_SIZE;
write_address += 1;
}
return r;
}
Expand Down

0 comments on commit e4dde73

Please sign in to comment.