<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/char/virtio_console.c, branch linux-2.6.37.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2011-03-14T21:17:31Z</updated>
<entry>
<title>virtio: console: Don't access vqs if device was unplugged</title>
<updated>2011-03-14T21:17:31Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2011-03-04T03:34:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=310f5e480c6facfdf9ee9e6952e490eebd3d8d55'/>
<id>urn:sha1:310f5e480c6facfdf9ee9e6952e490eebd3d8d55</id>
<content type='text'>
commit d7a62cd0332115d4c7c4689abea0d889a30d8349 upstream.

If a virtio-console device gets unplugged while a port is open, a
subsequent close() call on the port accesses vqs to free up buffers.
This can lead to a crash.

The buffers are already freed up as a result of the call to
unplug_ports() from virtcons_remove().  The fix is to simply not access
vq information if port-&gt;portdev is NULL.

Reported-by: juzhang &lt;juzhang@redhat.com&gt;
Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>virtio: console: Wake up outvq on host notifications</title>
<updated>2011-02-17T23:14:31Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2011-01-31T07:36:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3c1891dca97133a92658b0b03327ed706862a98'/>
<id>urn:sha1:e3c1891dca97133a92658b0b03327ed706862a98</id>
<content type='text'>
commit 2770c5ea501be69989a7acf54ec4cb3554c47191 upstream.

The outvq needs to be woken up on host notifications so that buffers
consumed by the host can be reclaimed, outvq freed, and application
writes may proceed again.

The need for this is now finally noticed when I have qemu patches ready
to use nonblocking IO and flow control.

CC: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Acked-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Char: virtio_console, fix memory leak</title>
<updated>2010-11-24T04:51:12Z</updated>
<author>
<name>Jiri Slaby</name>
</author>
<published>2010-11-06T09:06:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=22e132ff2645aab1e1a25c45e9544a39ae1dc106'/>
<id>urn:sha1:22e132ff2645aab1e1a25c45e9544a39ae1dc106</id>
<content type='text'>
Stanse found that in init_vqs, memory is leaked under certain
circumstanses (the fail path order is incorrect). Fix that by checking
allocations in one turn and free all of them at once if some fails
(some may be NULL, but this is OK).

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Amit Shah &lt;amit.shah@redhat.com&gt;
Cc: virtualization@lists.linux-foundation.org
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Disable lseek(2) for port file operations</title>
<updated>2010-10-21T07:14:04Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-16T09:13:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=299fb61c08c2fcd1bb6d3a4e87e53dc368475416'/>
<id>urn:sha1:299fb61c08c2fcd1bb6d3a4e87e53dc368475416</id>
<content type='text'>
The ports are char devices; do not have seeking capabilities.  Calling
nonseekable_open() from the fops_open() call and setting the llseek fops
pointer to no_llseek ensures an lseek() call from userspace returns
-ESPIPE.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
CC: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Send SIGIO in case of port unplug</title>
<updated>2010-10-21T07:14:04Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T13:17:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a461e11e7b8ca2705889bcf9582f6a8f84884bd2'/>
<id>urn:sha1:a461e11e7b8ca2705889bcf9582f6a8f84884bd2</id>
<content type='text'>
If a port has registered for SIGIO signals, let the application
know that the port is getting unplugged.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Send SIGIO on new data arrival on ports</title>
<updated>2010-10-21T07:14:04Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T13:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=55f6bcce3691f68476a530daa6666b66c43420a8'/>
<id>urn:sha1:55f6bcce3691f68476a530daa6666b66c43420a8</id>
<content type='text'>
Send a SIGIO signal when new data arrives on a port. This is sent only
when the process has requested for the signal to be sent using fcntl().

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Send SIGIO to processes that request it for host events</title>
<updated>2010-10-21T07:14:03Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T13:17:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3eae0adea949d8fdd8fa3e5301192901219d2c64'/>
<id>urn:sha1:3eae0adea949d8fdd8fa3e5301192901219d2c64</id>
<content type='text'>
A process can request for SIGIO on host connect / disconnect events
using the O_ASYNC file flag using fcntl().

If that's requested, and if the guest-side connection for the port is
open, any host-side open/close events for that port will raise a SIGIO.
The process can then use poll() within the signal handler to find out
which port triggered the signal.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Reference counting portdev structs is not needed</title>
<updated>2010-10-21T07:14:03Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T13:08:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e062013c7d22e40ee634b818d28fd615db36998e'/>
<id>urn:sha1:e062013c7d22e40ee634b818d28fd615db36998e</id>
<content type='text'>
Explain in a comment why there's no need to reference-count the portdev
struct: when a device is yanked out, we can't do anything more with it
anyway so just give up doing anything more with the data or the vqs and
exit cleanly.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Add reference counting for port struct</title>
<updated>2010-10-21T07:14:03Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T13:08:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b353a6b821627053f82b4e7b907e824cb7a6879c'/>
<id>urn:sha1:b353a6b821627053f82b4e7b907e824cb7a6879c</id>
<content type='text'>
When a port got hot-unplugged, when a port was open, any file operation
after the unplugging resulted in a crash. This is fixed by ref-counting
the port structure, and releasing it only when the file is closed.

This splits the unplug operation in two parts: first marks the port
as unavailable, removes all the buffers in the vqs and removes the port
from the per-device list of ports. The second stage, invoked when all
references drop to zero, releases the chardev and frees all other memory.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>virtio: console: Use cdev_alloc() instead of cdev_init()</title>
<updated>2010-10-21T07:14:03Z</updated>
<author>
<name>Amit Shah</name>
</author>
<published>2010-09-02T12:50:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d22a69892bd8f29e3096f6f54c2c00d8aec2e796'/>
<id>urn:sha1:d22a69892bd8f29e3096f6f54c2c00d8aec2e796</id>
<content type='text'>
This moves to using cdev on the heap instead of it being embedded in the
ports struct. This helps individual refcounting and will allow us to
properly remove cdev structs after hot-unplugs and close operations.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
</feed>
