<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/char/virtio_console.c, branch v4.4.171</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.171</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.171'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-05-02T14:53:40+00:00</updated>
<entry>
<title>virtio_console: free buffers after reset</title>
<updated>2018-05-02T14:53:40+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2018-04-20T17:24:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dd807a784fd36f4136516d5858efb6473dda422c'/>
<id>urn:sha1:dd807a784fd36f4136516d5858efb6473dda422c</id>
<content type='text'>
commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b upstream.

Console driver is out of spec. The spec says:
	A driver MUST NOT decrement the available idx on a live
	virtqueue (ie. there is no way to “unexpose” buffers).
and it does exactly that by trying to detach unused buffers
without doing a device reset first.

Defer detaching the buffers until device unplug.

Of course this means we might get an interrupt for
a vq without an attached port now. Handle that by
discarding the consumed buffer.

Reported-by: Tiwei Bie &lt;tiwei.bie@intel.com&gt;
Fixes: b3258ff1d6 ("virtio: Decrement avail idx on buffer detach")
Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>virtio_console: fix a crash in config_work_handler</title>
<updated>2017-07-05T12:37:18+00:00</updated>
<author>
<name>G. Campana</name>
<email>gcampana@quarkslab.com</email>
</author>
<published>2017-01-19T21:37:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=23c7f01691a131c4d29c9d7d00f89d888f2b008a'/>
<id>urn:sha1:23c7f01691a131c4d29c9d7d00f89d888f2b008a</id>
<content type='text'>
[ Upstream commit 8379cadf71c3ee8173a1c6fc1ea7762a9638c047 ]

Using control_work instead of config_work as the 3rd argument to
container_of results in an invalid portdev pointer. Indeed, the work
structure is initialized as below:

    INIT_WORK(&amp;portdev-&gt;config_work, &amp;config_work_handler);

It leads to a crash when portdev-&gt;vdev is dereferenced later. This
bug
is triggered when the guest uses a virtio-console without multiport
feature and receives a config_changed virtio interrupt.

Signed-off-by: G. Campana &lt;gcampana@quarkslab.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virtio-console: avoid DMA from stack</title>
<updated>2017-04-21T07:30:07+00:00</updated>
<author>
<name>Omar Sandoval</name>
<email>osandov@fb.com</email>
</author>
<published>2017-02-01T08:02:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eb5267657d85bfcbb60803dd88fa82c7dede6aab'/>
<id>urn:sha1:eb5267657d85bfcbb60803dd88fa82c7dede6aab</id>
<content type='text'>
commit c4baad50297d84bde1a7ad45e50c73adae4a2192 upstream.

put_chars() stuffs the buffer it gets into an sg, but that buffer may be
on the stack. This breaks with CONFIG_VMAP_STACK=y (for me, it
manifested as printks getting turned into NUL bytes).

Signed-off-by: Omar Sandoval &lt;osandov@fb.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Brad Spengler &lt;spender@grsecurity.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>virtio: console: Unlock vqs while freeing buffers</title>
<updated>2016-11-10T15:36:34+00:00</updated>
<author>
<name>Matt Redfearn</name>
<email>matt.redfearn@imgtec.com</email>
</author>
<published>2016-10-11T11:05:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88586a4f884c091f0746a0fd8d3d3acc0bac51f6'/>
<id>urn:sha1:88586a4f884c091f0746a0fd8d3d3acc0bac51f6</id>
<content type='text'>
commit 34563769e438d2881f62cf4d9badc4e589ac0ec0 upstream.

Commit c6017e793b93 ("virtio: console: add locks around buffer removal
in port unplug path") added locking around the freeing of buffers in the
vq. However, when free_buf() is called with can_sleep = true and rproc
is enabled, it calls dma_free_coherent() directly, requiring interrupts
to be enabled. Currently a WARNING is triggered due to the spin locking
around free_buf, with a call stack like this:

WARNING: CPU: 3 PID: 121 at ./include/linux/dma-mapping.h:433
free_buf+0x1a8/0x288
Call Trace:
[&lt;8040c538&gt;] show_stack+0x74/0xc0
[&lt;80757240&gt;] dump_stack+0xd0/0x110
[&lt;80430d98&gt;] __warn+0xfc/0x130
[&lt;80430ee0&gt;] warn_slowpath_null+0x2c/0x3c
[&lt;807e7c6c&gt;] free_buf+0x1a8/0x288
[&lt;807ea590&gt;] remove_port_data+0x50/0xac
[&lt;807ea6a0&gt;] unplug_port+0xb4/0x1bc
[&lt;807ea858&gt;] virtcons_remove+0xb0/0xfc
[&lt;807b6734&gt;] virtio_dev_remove+0x58/0xc0
[&lt;807f918c&gt;] __device_release_driver+0xac/0x134
[&lt;807f924c&gt;] device_release_driver+0x38/0x50
[&lt;807f7edc&gt;] bus_remove_device+0xfc/0x130
[&lt;807f4b74&gt;] device_del+0x17c/0x21c
[&lt;807f4c38&gt;] device_unregister+0x24/0x38
[&lt;807b6b50&gt;] unregister_virtio_device+0x28/0x44

Fix this by restructuring the loops to allow the locks to only be taken
where it is necessary to protect the vqs, and release it while the
buffer is being freed.

Fixes: c6017e793b93 ("virtio: console: add locks around buffer removal in port unplug path")
Signed-off-by: Matt Redfearn &lt;matt.redfearn@imgtec.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>virtio_console: silence a static checker warning</title>
<updated>2015-05-24T19:24:35+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2015-05-08T09:16:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=db1700685c0ad2ecb9e42af6a568435a03bbc3fd'/>
<id>urn:sha1:db1700685c0ad2ecb9e42af6a568435a03bbc3fd</id>
<content type='text'>
My static checker complains that this sprintf() can overflow but really
it can't.  Just silence the warning by using snprintf().

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virtio_console: Use bool function return values of true/false not 1/0</title>
<updated>2015-04-03T14:15:30+00:00</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-03-30T23:46:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f580d730c90c11be0ef4fe88aff3de80845176cb'/>
<id>urn:sha1:f580d730c90c11be0ef4fe88aff3de80845176cb</id>
<content type='text'>
Use the normal return values for bool functions

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virtio_console: avoid config access from irq</title>
<updated>2015-03-05T03:06:18+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2015-03-05T00:15:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2'/>
<id>urn:sha1:eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2</id>
<content type='text'>
when multiport is off, virtio console invokes config access from irq
context, config access is blocking on s390.
Fix this up by scheduling work from config irq - similar to what we do
for multiport configs.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>virtio_console: init work unconditionally</title>
<updated>2015-03-05T03:06:17+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2015-03-05T00:15:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f6e24ed9de8634d6471ef86b382cba6d4e57ca8'/>
<id>urn:sha1:4f6e24ed9de8634d6471ef86b382cba6d4e57ca8</id>
<content type='text'>
when multiport is off, we don't initialize config work,
but we then cancel uninitialized control_work on freeze.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>virtio: don't require a config space on the console device.</title>
<updated>2015-02-11T04:33:17+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2015-02-11T04:31:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=be8ff5952a8d943660d3c01f1abf4e71eb565fdb'/>
<id>urn:sha1:be8ff5952a8d943660d3c01f1abf4e71eb565fdb</id>
<content type='text'>
Strictly, it's only needed when we have features (size or multiport).

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio/console: verify device has config space</title>
<updated>2015-01-21T05:58:46+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2015-01-12T14:23:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=011f0e7a6944855436fb29c7a7e6c3c89c95f8fb'/>
<id>urn:sha1:011f0e7a6944855436fb29c7a7e6c3c89c95f8fb</id>
<content type='text'>
Some devices might not implement config space access
(e.g. remoteproc used not to - before 3.9).
virtio/console needs config space access so make it
fail gracefully if not there.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
</feed>
