]> git.karo-electronics.de Git - karo-tx-linux.git/commit
virtio_balloon: leak_balloon(): only tell host if we got pages deflated
authorLuiz Capitulino <lcapitulino@redhat.com>
Wed, 19 Jun 2013 00:05:35 +0000 (10:05 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:12:46 +0000 (17:12 +1000)
commit677515f32912afd74cfae9f6db66232c9a6f7a5f
tree9e3380ee1b9af03857b4c6baa94e90cfe7854624
parent1e9be1912ee00927c6eb97fbf363c02b879ce5db
virtio_balloon: leak_balloon(): only tell host if we got pages deflated

balloon_page_dequeue() can return NULL.  If it does for the first page
being freed then leak_balloon() will create a scatter list with len=0.
Which in turn seems to generate an invalid virtio request.

I didn't get this in practice, I found it by code review.  On the other
hand, such an invalid virtio request will cause errors in QEMU and
fill_balloon() also performs the same check implemented by this commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Rafael Aquini <aquini@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/virtio/virtio_balloon.c