summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPankaj Gupta <pagupta@redhat.com>2019-03-19 11:34:06 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 06:46:29 -0700
commit3392cc5f3ce3cd67d2a8dc7ebbb271e660569bd3 (patch)
tree936172dc7d23e154b960ac8df0230d6e3836b48b /drivers/char
parente819d4a13688eef567679471fbcaa933db400551 (diff)
downloadlinux-stable-3392cc5f3ce3cd67d2a8dc7ebbb271e660569bd3.tar.gz
linux-stable-3392cc5f3ce3cd67d2a8dc7ebbb271e660569bd3.tar.bz2
linux-stable-3392cc5f3ce3cd67d2a8dc7ebbb271e660569bd3.zip
virtio_console: initialize vtermno value for ports
[ Upstream commit 4b0a2c5ff7215206ea6135a405f17c5f6fca7d00 ] For regular serial ports we do not initialize value of vtermno variable. A garbage value is assigned for non console ports. The value can be observed as a random integer with [1]. [1] vim /sys/kernel/debug/virtio-ports/vport*p* This patch initialize the value of vtermno for console serial ports to '1' and regular serial ports are initiaized to '0'. Reported-by: siliu@redhat.com Signed-off-by: Pankaj Gupta <pagupta@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/virtio_console.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 5b5b5d72eab7..c55f6aeb4227 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -75,7 +75,7 @@ struct ports_driver_data {
/* All the console devices handled by this driver */
struct list_head consoles;
};
-static struct ports_driver_data pdrvdata;
+static struct ports_driver_data pdrvdata = { .next_vtermno = 1};
static DEFINE_SPINLOCK(pdrvdata_lock);
static DECLARE_COMPLETION(early_console_added);
@@ -1405,6 +1405,7 @@ static int add_port(struct ports_device *portdev, u32 id)
port->async_queue = NULL;
port->cons.ws.ws_row = port->cons.ws.ws_col = 0;
+ port->cons.vtermno = 0;
port->host_connected = port->guest_connected = false;
port->stats = (struct port_stats) { 0 };