summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-09-14 07:36:40 (GMT)
committerRusty Russell <rusty@rustcorp.com.au>2011-11-02 01:10:59 (GMT)
commit291024ef351328e7b4ca6bae798abc816a43653c (patch)
treeda54013a26d70be3136266692eea6ac95077f865 /drivers
parent286f9a226f11e4a05d08999417fd838c0ca91d7a (diff)
downloadlinux-291024ef351328e7b4ca6bae798abc816a43653c.tar.xz
virtio: console: Ignore port name update request if name already set
We don't allow port name changes dynamically for a port. So any requests by the host to change the name are ignored. Before this patch, if the hypervisor sent a port name while we had one set already, we would leak memory equivalent to the size of the old name. This scenario wasn't expected so far, but with the suspend-resume support, we'll send the VIRTIO_CONSOLE_PORT_READY message after restore, which can get us into this situation. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/virtio_console.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 10280a2..5397884 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1394,6 +1394,13 @@ static void handle_control_message(struct ports_device *portdev,
break;
case VIRTIO_CONSOLE_PORT_NAME:
/*
+ * If we woke up after hibernation, we can get this
+ * again. Skip it in that case.
+ */
+ if (port->name)
+ break;
+
+ /*
* Skip the size of the header and the cpkt to get the size
* of the name that was sent
*/