Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio_console: initialize vtermno value for ports

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>

authored by

Pankaj Gupta and committed by
Greg Kroah-Hartman
4b0a2c5f 67fbfc39

+2 -1
+2 -1
drivers/char/virtio_console.c
··· 75 75 /* All the console devices handled by this driver */ 76 76 struct list_head consoles; 77 77 }; 78 - static struct ports_driver_data pdrvdata; 78 + static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; 79 79 80 80 static DEFINE_SPINLOCK(pdrvdata_lock); 81 81 static DECLARE_COMPLETION(early_console_added); ··· 1394 1394 port->async_queue = NULL; 1395 1395 1396 1396 port->cons.ws.ws_row = port->cons.ws.ws_col = 0; 1397 + port->cons.vtermno = 0; 1397 1398 1398 1399 port->host_connected = port->guest_connected = false; 1399 1400 port->stats = (struct port_stats) { 0 };