]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio-balloon: Add locking to prevent possible race when starting hinting
authorAlexander Duyck <alexander.h.duyck@linux.intel.com>
Mon, 20 Jul 2020 17:51:22 +0000 (10:51 -0700)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Sep 2020 00:06:19 +0000 (19:06 -0500)
commit7eb63fccf4cc533249bde484daba6e40264d74f9
tree12a1e978e51ae0c6d52b85062752d4956c14dbd7
parent67808fda375e3a795ae84f3fb19b540f954fa96a
virtio-balloon: Add locking to prevent possible race when starting hinting

There is already locking in place when we are stopping free page hinting
but there is not similar protections in place when we start. I can only
assume this was overlooked as in most cases the page hinting should not be
occurring when we are starting the hinting, however there is still a chance
we could be processing hints by the time we get back around to restarting
the hinting so we are better off making sure to protect the state with the
mutex lock rather than just updating the value with no protections.

Based on feedback from Peter Maydell this issue had also been spotted by
Coverity: CID 1430269

Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Message-Id: <20200720175122.21935.78013.stgit@localhost.localdomain>
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1a83e0b9c492a0eaeacd6fbb858fc81d04ab9c3e)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-balloon.c