]> 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>
Thu, 27 Jun 2013 23:51:01 +0000 (09:51 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:37:15 +0000 (16:37 +1000)
commit6cce6966f780415efa99873c833d3698daf575ad
treeabd150dbd09acf1d02253ec83d7be04a5a6451da
parent014846b1c36d73938570f354697cb5dcd5e12648
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