]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 7aaa89e6e9a11ccebe11c5be97913644c1bbd124 Mon Sep 17 00:00:00 2001 |
2 | From: Pankaj Gupta <pagupta@redhat.com> | |
3 | Date: Tue, 19 Mar 2019 11:34:06 +0530 | |
4 | Subject: virtio_console: initialize vtermno value for ports | |
5 | ||
6 | [ Upstream commit 4b0a2c5ff7215206ea6135a405f17c5f6fca7d00 ] | |
7 | ||
8 | For regular serial ports we do not initialize value of vtermno | |
9 | variable. A garbage value is assigned for non console ports. | |
10 | The value can be observed as a random integer with [1]. | |
11 | ||
12 | [1] vim /sys/kernel/debug/virtio-ports/vport*p* | |
13 | ||
14 | This patch initialize the value of vtermno for console serial | |
15 | ports to '1' and regular serial ports are initiaized to '0'. | |
16 | ||
17 | Reported-by: siliu@redhat.com | |
18 | Signed-off-by: Pankaj Gupta <pagupta@redhat.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | drivers/char/virtio_console.c | 3 ++- | |
23 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
24 | ||
25 | diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c | |
26 | index 2aca689061e1f..df9eab91c2d25 100644 | |
27 | --- a/drivers/char/virtio_console.c | |
28 | +++ b/drivers/char/virtio_console.c | |
29 | @@ -76,7 +76,7 @@ struct ports_driver_data { | |
30 | /* All the console devices handled by this driver */ | |
31 | struct list_head consoles; | |
32 | }; | |
33 | -static struct ports_driver_data pdrvdata; | |
34 | +static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; | |
35 | ||
36 | static DEFINE_SPINLOCK(pdrvdata_lock); | |
37 | static DECLARE_COMPLETION(early_console_added); | |
38 | @@ -1419,6 +1419,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |
39 | port->async_queue = NULL; | |
40 | ||
41 | port->cons.ws.ws_row = port->cons.ws.ws_col = 0; | |
42 | + port->cons.vtermno = 0; | |
43 | ||
44 | port->host_connected = port->guest_connected = false; | |
45 | port->stats = (struct port_stats) { 0 }; | |
46 | -- | |
47 | 2.20.1 | |
48 |