From: Rusty Russell Date: Tue, 18 Mar 2008 03:58:15 +0000 (-0500) Subject: virtio: handle > 2 billion page balloon targets X-Git-Tag: v2.6.25-rc7~114^2~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=bdc1681cdf1ab6a65fa935a2b3f8fc63b20c54ea;p=linux-2.6-omap-h63xx.git 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 --- diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c8a4332d113..0b3efc31ee6 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) 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; __virtio_config_val(vb->vdev, @@ -176,7 +176,7 @@ static int balloon(void *_vballoon) set_freezable(); while (!kthread_should_stop()) { - int diff; + s64 diff; try_to_freeze(); wait_event_interruptible(vb->config_change,