Commit bdc1681c authored by Rusty Russell's avatar Rusty Russell

virtio: handle > 2 billion page balloon targets

If the host asks for a huge target towards_target() can overflow, and
we up oops as we try to release more pages than we have.  The simple
fix is to use a 64-bit value.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent c4839346
...@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev) ...@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev)
wake_up(&vb->config_change); wake_up(&vb->config_change);
} }
static inline int towards_target(struct virtio_balloon *vb) static inline s64 towards_target(struct virtio_balloon *vb)
{ {
u32 v; u32 v;
__virtio_config_val(vb->vdev, __virtio_config_val(vb->vdev,
...@@ -176,7 +176,7 @@ static int balloon(void *_vballoon) ...@@ -176,7 +176,7 @@ static int balloon(void *_vballoon)
set_freezable(); set_freezable();
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
int diff; s64 diff;
try_to_freeze(); try_to_freeze();
wait_event_interruptible(vb->config_change, wait_event_interruptible(vb->config_change,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment