diff mbox

[2/4] kvm tools: Do not forget to take the lock in virtio_console_pci_io_out

Message ID 1302624856-884-2-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He April 12, 2011, 4:14 p.m. UTC
Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/virtio-console.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/virtio-console.c b/tools/kvm/virtio-console.c
index 9675090..aa9b1bd 100644
--- a/tools/kvm/virtio-console.c
+++ b/tools/kvm/virtio-console.c
@@ -163,6 +163,8 @@  static bool virtio_console_pci_io_out(struct kvm *self, uint16_t port, void *dat
 	unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
 	bool ret = true;
 
+	mutex_lock(&console_device.mutex);
+
 	switch (offset) {
 	case VIRTIO_PCI_GUEST_FEATURES:
 		console_device.guest_features	= ioport__read32(data);