Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3392cc5f authored by Pankaj Gupta's avatar Pankaj Gupta Committed by Greg Kroah-Hartman
Browse files

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: default avatar <siliu@redhat.com>
Signed-off-by: default avatarPankaj Gupta <pagupta@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e819d4a1
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -75,7 +75,7 @@ struct ports_driver_data {
	/* All the console devices handled by this driver */
	/* All the console devices handled by this driver */
	struct list_head consoles;
	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 DEFINE_SPINLOCK(pdrvdata_lock);
static DECLARE_COMPLETION(early_console_added);
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->async_queue = NULL;


	port->cons.ws.ws_row = port->cons.ws.ws_col = 0;
	port->cons.ws.ws_row = port->cons.ws.ws_col = 0;
	port->cons.vtermno = 0;


	port->host_connected = port->guest_connected = false;
	port->host_connected = port->guest_connected = false;
	port->stats = (struct port_stats) { 0 };
	port->stats = (struct port_stats) { 0 };