virtio_balloon: fix race by fill and leak
[cascardo/linux.git] / drivers / virtio / virtio_balloon.c
index 7efc329..7d3e5d0 100644 (file)
@@ -209,8 +209,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
         */
        if (vb->num_pfns != 0)
                tell_host(vb, vb->deflate_vq);
-       mutex_unlock(&vb->balloon_lock);
        release_pages_balloon(vb);
+       mutex_unlock(&vb->balloon_lock);
        return num_freed_pages;
 }