diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2008-03-17 23:58:15 -0400 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-03-17 07:58:19 -0400 |
| commit | bdc1681cdf1ab6a65fa935a2b3f8fc63b20c54ea (patch) | |
| tree | 17910bdca2cee81b0d4a3ee877aec82db0017a09 | |
| parent | c483934670d31e064e18967bb679c1079b54ea72 (diff) | |
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: Rusty Russell <rusty@rustcorp.com.au>
| -rw-r--r-- | drivers/virtio/virtio_balloon.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c8a4332d1132..0b3efc31ee6d 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
| 152 | wake_up(&vb->config_change); | 152 | wake_up(&vb->config_change); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static inline int towards_target(struct virtio_balloon *vb) | 155 | static inline s64 towards_target(struct virtio_balloon *vb) |
| 156 | { | 156 | { |
| 157 | u32 v; | 157 | u32 v; |
| 158 | __virtio_config_val(vb->vdev, | 158 | __virtio_config_val(vb->vdev, |
| @@ -176,7 +176,7 @@ static int balloon(void *_vballoon) | |||
| 176 | 176 | ||
| 177 | set_freezable(); | 177 | set_freezable(); |
| 178 | while (!kthread_should_stop()) { | 178 | while (!kthread_should_stop()) { |
| 179 | int diff; | 179 | s64 diff; |
| 180 | 180 | ||
| 181 | try_to_freeze(); | 181 | try_to_freeze(); |
| 182 | wait_event_interruptible(vb->config_change, | 182 | wait_event_interruptible(vb->config_change, |
