<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/char/virtio_console.c, branch linux-3.4.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>virtio_console: avoid config access from irq</title>
<updated>2015-06-19T03:40:25+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.tavy.me/linux-stable.git/commit/?id=c1c04e785012d1f8deab4a5537d4688dd97013e9'/>
<id>c1c04e785012d1f8deab4a5537d4688dd97013e9</id>
<content type='text'>
commit eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2 upstream.

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;
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2 upstream.

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;
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio_console: init work unconditionally</title>
<updated>2015-06-19T03:40:25+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.tavy.me/linux-stable.git/commit/?id=0a1429620345f77cbbfb3adc8522d7d212a84d50'/>
<id>0a1429620345f77cbbfb3adc8522d7d212a84d50</id>
<content type='text'>
commit 4f6e24ed9de8634d6471ef86b382cba6d4e57ca8 upstream.

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;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4f6e24ed9de8634d6471ef86b382cba6d4e57ca8 upstream.

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;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: add locking around c_ovq operations</title>
<updated>2014-06-11T19:04:18+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-03-29T11:00:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0e2400e24c096092c7b4cf736160d4e5e9070dec'/>
<id>0e2400e24c096092c7b4cf736160d4e5e9070dec</id>
<content type='text'>
commit 9ba5c80b1aea8648a3efe5f22dc1f7cacdfbeeb8 upstream.

When multiple ovq operations are being performed (lots of open/close
operations on virtio_console fds), the __send_control_msg() function can
get confused without locking.

A simple recipe to cause badness is:
* create a QEMU VM with two virtio-serial ports
* in the guest, do
  while true;do echo abc &gt;/dev/vport0p1;done
  while true;do echo edf &gt;/dev/vport0p2;done

In one run, this caused a panic in __send_control_msg().  In another, I
got

   virtio_console virtio0: control-o:id 0 is not a head!

This also results repeated messages similar to these on the host:

  qemu-kvm: virtio-serial-bus: Unexpected port id 478762112 for device virtio-serial-bus.0
  qemu-kvm: virtio-serial-bus: Unexpected port id 478762368 for device virtio-serial-bus.0

Reported-by: FuXiangChun &lt;xfu@redhat.com&gt;
Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Reviewed-by: Wanlong Gao &lt;gaowanlong@cn.fujitsu.com&gt;
Reviewed-by: Asias He &lt;asias@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
[wyj: Backported to 3.4: adjust context]
Signed-off-by: Yijing Wang &lt;wangyijing@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 9ba5c80b1aea8648a3efe5f22dc1f7cacdfbeeb8 upstream.

When multiple ovq operations are being performed (lots of open/close
operations on virtio_console fds), the __send_control_msg() function can
get confused without locking.

A simple recipe to cause badness is:
* create a QEMU VM with two virtio-serial ports
* in the guest, do
  while true;do echo abc &gt;/dev/vport0p1;done
  while true;do echo edf &gt;/dev/vport0p2;done

In one run, this caused a panic in __send_control_msg().  In another, I
got

   virtio_console virtio0: control-o:id 0 is not a head!

This also results repeated messages similar to these on the host:

  qemu-kvm: virtio-serial-bus: Unexpected port id 478762112 for device virtio-serial-bus.0
  qemu-kvm: virtio-serial-bus: Unexpected port id 478762368 for device virtio-serial-bus.0

Reported-by: FuXiangChun &lt;xfu@redhat.com&gt;
Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Reviewed-by: Wanlong Gao &lt;gaowanlong@cn.fujitsu.com&gt;
Reviewed-by: Asias He &lt;asias@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
[wyj: Backported to 3.4: adjust context]
Signed-off-by: Yijing Wang &lt;wangyijing@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: rename cvq_lock to c_ivq_lock</title>
<updated>2014-06-11T19:04:18+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-03-29T11:00:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e83f2e8240f4dbc8f2740f9fc999d7bb10351e61'/>
<id>e83f2e8240f4dbc8f2740f9fc999d7bb10351e61</id>
<content type='text'>
commit 165b1b8bbc17c9469b053bab78b11b7cbce6d161 upstream.

The cvq_lock was taken for the c_ivq.  Rename the lock to make that
obvious.

We'll also add a lock around the c_ovq in the next commit, so there's no
ambiguity.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Reviewed-by: Asias He &lt;asias@redhat.com&gt;
Reviewed-by: Wanlong Gao &lt;gaowanlong@cn.fujitsu.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Drop change to virtcons_restore()]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
[wyj: Backported to 3.4:
 - pick change to virtcons_restore() from upsteam patch]
Signed-off-by: Yijing Wang &lt;wangyijing@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 165b1b8bbc17c9469b053bab78b11b7cbce6d161 upstream.

The cvq_lock was taken for the c_ivq.  Rename the lock to make that
obvious.

We'll also add a lock around the c_ovq in the next commit, so there's no
ambiguity.

Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Reviewed-by: Asias He &lt;asias@redhat.com&gt;
Reviewed-by: Wanlong Gao &lt;gaowanlong@cn.fujitsu.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Drop change to virtcons_restore()]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
[wyj: Backported to 3.4:
 - pick change to virtcons_restore() from upsteam patch]
Signed-off-by: Yijing Wang &lt;wangyijing@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: return -ENODEV on all read operations after unplug</title>
<updated>2013-08-15T05:57:07+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:53:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a57425e942b49e729a62ccb4d420ae7c83762fe2'/>
<id>a57425e942b49e729a62ccb4d420ae7c83762fe2</id>
<content type='text'>
commit 96f97a83910cdb9d89d127c5ee523f8fc040a804 upstream.

If a port gets unplugged while a user is blocked on read(), -ENODEV is
returned.  However, subsequent read()s returned 0, indicating there's no
host-side connection (but not indicating the device went away).

This also happened when a port was unplugged and the user didn't have
any blocking operation pending.  If the user didn't monitor the SIGIO
signal, they won't have a chance to find out if the port went away.

Fix by returning -ENODEV on all read()s after the port gets unplugged.
write() already behaves this way.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 96f97a83910cdb9d89d127c5ee523f8fc040a804 upstream.

If a port gets unplugged while a user is blocked on read(), -ENODEV is
returned.  However, subsequent read()s returned 0, indicating there's no
host-side connection (but not indicating the device went away).

This also happened when a port was unplugged and the user didn't have
any blocking operation pending.  If the user didn't monitor the SIGIO
signal, they won't have a chance to find out if the port went away.

Fix by returning -ENODEV on all read()s after the port gets unplugged.
write() already behaves this way.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: fix raising SIGIO after port unplug</title>
<updated>2013-08-15T05:57:07+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:51:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=183c6a6b4ec8efa1a862b07eb4523d8781ae3e44'/>
<id>183c6a6b4ec8efa1a862b07eb4523d8781ae3e44</id>
<content type='text'>
commit 92d3453815fbe74d539c86b60dab39ecdf01bb99 upstream.

SIGIO should be sent when a port gets unplugged.  It should only be sent
to prcesses that have the port opened, and have asked for SIGIO to be
delivered.  We were clearing out guest_connected before calling
send_sigio_to_port(), resulting in a sigio not getting sent to
processes.

Fix by setting guest_connected to false after invoking the sigio
function.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 92d3453815fbe74d539c86b60dab39ecdf01bb99 upstream.

SIGIO should be sent when a port gets unplugged.  It should only be sent
to prcesses that have the port opened, and have asked for SIGIO to be
delivered.  We were clearing out guest_connected before calling
send_sigio_to_port(), resulting in a sigio not getting sent to
processes.

Fix by setting guest_connected to false after invoking the sigio
function.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: clean up port data immediately at time of unplug</title>
<updated>2013-08-15T05:57:06+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:50:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9f92fafcadb619514dbab90882ddfe60245572cd'/>
<id>9f92fafcadb619514dbab90882ddfe60245572cd</id>
<content type='text'>
commit ea3768b4386a8d1790f4cc9a35de4f55b92d6442 upstream.

We used to keep the port's char device structs and the /sys entries
around till the last reference to the port was dropped.  This is
actually unnecessary, and resulted in buggy behaviour:

1. Open port in guest
2. Hot-unplug port
3. Hot-plug a port with the same 'name' property as the unplugged one

This resulted in hot-plug being unsuccessful, as a port with the same
name already exists (even though it was unplugged).

This behaviour resulted in a warning message like this one:

-------------------8&lt;---------------------------------------
WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
Hardware name: KVM
sysfs: cannot create duplicate filename
'/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'

Call Trace:
 [&lt;ffffffff8106b607&gt;] ? warn_slowpath_common+0x87/0xc0
 [&lt;ffffffff8106b6f6&gt;] ? warn_slowpath_fmt+0x46/0x50
 [&lt;ffffffff811f2319&gt;] ? sysfs_add_one+0xc9/0x130
 [&lt;ffffffff811f23e8&gt;] ? create_dir+0x68/0xb0
 [&lt;ffffffff811f2469&gt;] ? sysfs_create_dir+0x39/0x50
 [&lt;ffffffff81273129&gt;] ? kobject_add_internal+0xb9/0x260
 [&lt;ffffffff812733d8&gt;] ? kobject_add_varg+0x38/0x60
 [&lt;ffffffff812734b4&gt;] ? kobject_add+0x44/0x70
 [&lt;ffffffff81349de4&gt;] ? get_device_parent+0xf4/0x1d0
 [&lt;ffffffff8134b389&gt;] ? device_add+0xc9/0x650

-------------------8&lt;---------------------------------------

Instead of relying on guest applications to release all references to
the ports, we should go ahead and unregister the port from all the core
layers.  Any open/read calls on the port will then just return errors,
and an unplug/plug operation on the host will succeed as expected.

This also caused buggy behaviour in case of the device removal (not just
a port): when the device was removed (which means all ports on that
device are removed automatically as well), the ports with active
users would clean up only when the last references were dropped -- and
it would be too late then to be referencing char device pointers,
resulting in oopses:

-------------------8&lt;---------------------------------------
PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
 #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
 #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
 #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
 #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
    [exception RIP: strlen+2]
    RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
    RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
    RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
    R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
    R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
 #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
 #9 [ffff88011b9d5de0] device_del at ffffffff813440c7

-------------------8&lt;---------------------------------------

So clean up when we have all the context, and all that's left to do when
the references to the port have dropped is to free up the port struct
itself.

Reported-by: chayang &lt;chayang@redhat.com&gt;
Reported-by: YOGANANTH SUBRAMANIAN &lt;anantyog@in.ibm.com&gt;
Reported-by: FuXiangChun &lt;xfu@redhat.com&gt;
Reported-by: Qunfang Zhang &lt;qzhang@redhat.com&gt;
Reported-by: Sibiao Luo &lt;sluo@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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit ea3768b4386a8d1790f4cc9a35de4f55b92d6442 upstream.

We used to keep the port's char device structs and the /sys entries
around till the last reference to the port was dropped.  This is
actually unnecessary, and resulted in buggy behaviour:

1. Open port in guest
2. Hot-unplug port
3. Hot-plug a port with the same 'name' property as the unplugged one

This resulted in hot-plug being unsuccessful, as a port with the same
name already exists (even though it was unplugged).

This behaviour resulted in a warning message like this one:

-------------------8&lt;---------------------------------------
WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
Hardware name: KVM
sysfs: cannot create duplicate filename
'/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'

Call Trace:
 [&lt;ffffffff8106b607&gt;] ? warn_slowpath_common+0x87/0xc0
 [&lt;ffffffff8106b6f6&gt;] ? warn_slowpath_fmt+0x46/0x50
 [&lt;ffffffff811f2319&gt;] ? sysfs_add_one+0xc9/0x130
 [&lt;ffffffff811f23e8&gt;] ? create_dir+0x68/0xb0
 [&lt;ffffffff811f2469&gt;] ? sysfs_create_dir+0x39/0x50
 [&lt;ffffffff81273129&gt;] ? kobject_add_internal+0xb9/0x260
 [&lt;ffffffff812733d8&gt;] ? kobject_add_varg+0x38/0x60
 [&lt;ffffffff812734b4&gt;] ? kobject_add+0x44/0x70
 [&lt;ffffffff81349de4&gt;] ? get_device_parent+0xf4/0x1d0
 [&lt;ffffffff8134b389&gt;] ? device_add+0xc9/0x650

-------------------8&lt;---------------------------------------

Instead of relying on guest applications to release all references to
the ports, we should go ahead and unregister the port from all the core
layers.  Any open/read calls on the port will then just return errors,
and an unplug/plug operation on the host will succeed as expected.

This also caused buggy behaviour in case of the device removal (not just
a port): when the device was removed (which means all ports on that
device are removed automatically as well), the ports with active
users would clean up only when the last references were dropped -- and
it would be too late then to be referencing char device pointers,
resulting in oopses:

-------------------8&lt;---------------------------------------
PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
 #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
 #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
 #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
 #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
    [exception RIP: strlen+2]
    RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
    RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
    RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
    R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
    R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
 #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
 #9 [ffff88011b9d5de0] device_del at ffffffff813440c7

-------------------8&lt;---------------------------------------

So clean up when we have all the context, and all that's left to do when
the references to the port have dropped is to free up the port struct
itself.

Reported-by: chayang &lt;chayang@redhat.com&gt;
Reported-by: YOGANANTH SUBRAMANIAN &lt;anantyog@in.ibm.com&gt;
Reported-by: FuXiangChun &lt;xfu@redhat.com&gt;
Reported-by: Qunfang Zhang &lt;qzhang@redhat.com&gt;
Reported-by: Sibiao Luo &lt;sluo@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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: fix race in port_fops_open() and port unplug</title>
<updated>2013-08-15T05:57:06+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:47:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9c040cbf67c54c0eb67ebdc0424cfadd3d7a2a7a'/>
<id>9c040cbf67c54c0eb67ebdc0424cfadd3d7a2a7a</id>
<content type='text'>
commit 671bdea2b9f210566610603ecbb6584c8a201c8c upstream.

Between open() being called and processed, the port can be unplugged.
Check if this happened, and bail out.

A simple test script to reproduce this is:

while true; do for i in $(seq 1 100); do echo $i &gt; /dev/vport0p3; done; done;

This opens and closes the port a lot of times; unplugging the port while
this is happening triggers the bug.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 671bdea2b9f210566610603ecbb6584c8a201c8c upstream.

Between open() being called and processed, the port can be unplugged.
Check if this happened, and bail out.

A simple test script to reproduce this is:

while true; do for i in $(seq 1 100); do echo $i &gt; /dev/vport0p3; done; done;

This opens and closes the port a lot of times; unplugging the port while
this is happening triggers the bug.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: console: fix race with port unplug and open/close</title>
<updated>2013-08-15T05:57:06+00:00</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:46:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d0bfaacabec9c87b739c31662eaa96af0d1b404c'/>
<id>d0bfaacabec9c87b739c31662eaa96af0d1b404c</id>
<content type='text'>
commit 057b82be3ca3d066478e43b162fc082930a746c9 upstream.

There's a window between find_port_by_devt() returning a port and us
taking a kref on the port, where the port could get unplugged.  Fix it
by taking the reference in find_port_by_devt() itself.

Problem reported and analyzed by Mateusz Guzik.

Reported-by: Mateusz Guzik &lt;mguzik@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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 057b82be3ca3d066478e43b162fc082930a746c9 upstream.

There's a window between find_port_by_devt() returning a port and us
taking a kref on the port, where the port could get unplugged.  Fix it
by taking the reference in find_port_by_devt() itself.

Problem reported and analyzed by Mateusz Guzik.

Reported-by: Mateusz Guzik &lt;mguzik@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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio_console: Don't access uninitialized data.</title>
<updated>2013-02-14T18:48:51+00:00</updated>
<author>
<name>Sjur Brændeland</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2013-01-21T23:20:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0b2d4e113bf714732b041aa879945c4c5ae4b139'/>
<id>0b2d4e113bf714732b041aa879945c4c5ae4b139</id>
<content type='text'>
commit aded024a12b32fc1ed9a80639681daae2d07ec25 upstream.

Don't access uninitialized work-queue when removing device.
The work queue is initialized only if the device multi-queue.
So don't call cancel_work unless this is a multi-queue device.

This fixes the following panic:

Kernel panic - not syncing: BUG!
Call Trace:
62031b28:  [&lt;6026085d&gt;] panic+0x16b/0x2d3
62031b30:  [&lt;6004ef5e&gt;] flush_work+0x0/0x1d7
62031b60:  [&lt;602606f2&gt;] panic+0x0/0x2d3
62031b68:  [&lt;600333b0&gt;] memcpy+0x0/0x140
62031b80:  [&lt;6002d58a&gt;] unblock_signals+0x0/0x84
62031ba0:  [&lt;602609c5&gt;] printk+0x0/0xa0
62031bd8:  [&lt;60264e51&gt;] __mutex_unlock_slowpath+0x13d/0x148
62031c10:  [&lt;6004ef5e&gt;] flush_work+0x0/0x1d7
62031c18:  [&lt;60050234&gt;] try_to_grab_pending+0x0/0x17e
62031c38:  [&lt;6004e984&gt;] get_work_gcwq+0x71/0x8f
62031c48:  [&lt;60050539&gt;] __cancel_work_timer+0x5b/0x115
62031c78:  [&lt;628acc85&gt;] unplug_port+0x0/0x191 [virtio_console]
62031c98:  [&lt;6005061c&gt;] cancel_work_sync+0x12/0x14
62031ca8:  [&lt;628ace96&gt;] virtcons_remove+0x80/0x15c [virtio_console]
62031ce8:  [&lt;628191de&gt;] virtio_dev_remove+0x1e/0x7e [virtio]
62031d08:  [&lt;601cf242&gt;] __device_release_driver+0x75/0xe4
62031d28:  [&lt;601cf2dd&gt;] device_release_driver+0x2c/0x40
62031d48:  [&lt;601ce0dd&gt;] driver_unbind+0x7d/0xc6
62031d88:  [&lt;601cd5d9&gt;] drv_attr_store+0x27/0x29
62031d98:  [&lt;60115f61&gt;] sysfs_write_file+0x100/0x14d
62031df8:  [&lt;600b737d&gt;] vfs_write+0xcb/0x184
62031e08:  [&lt;600b58b8&gt;] filp_close+0x88/0x94
62031e38:  [&lt;600b7686&gt;] sys_write+0x59/0x88
62031e88:  [&lt;6001ced1&gt;] handle_syscall+0x5d/0x80
62031ea8:  [&lt;60030a74&gt;] userspace+0x405/0x531
62031f08:  [&lt;600d32cc&gt;] sys_dup+0x0/0x5e
62031f28:  [&lt;601b11d6&gt;] strcpy+0x0/0x18
62031f38:  [&lt;600be46c&gt;] do_execve+0x10/0x12
62031f48:  [&lt;600184c7&gt;] run_init_process+0x43/0x45
62031fd8:  [&lt;60019a91&gt;] new_thread_handler+0xba/0xbc

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit aded024a12b32fc1ed9a80639681daae2d07ec25 upstream.

Don't access uninitialized work-queue when removing device.
The work queue is initialized only if the device multi-queue.
So don't call cancel_work unless this is a multi-queue device.

This fixes the following panic:

Kernel panic - not syncing: BUG!
Call Trace:
62031b28:  [&lt;6026085d&gt;] panic+0x16b/0x2d3
62031b30:  [&lt;6004ef5e&gt;] flush_work+0x0/0x1d7
62031b60:  [&lt;602606f2&gt;] panic+0x0/0x2d3
62031b68:  [&lt;600333b0&gt;] memcpy+0x0/0x140
62031b80:  [&lt;6002d58a&gt;] unblock_signals+0x0/0x84
62031ba0:  [&lt;602609c5&gt;] printk+0x0/0xa0
62031bd8:  [&lt;60264e51&gt;] __mutex_unlock_slowpath+0x13d/0x148
62031c10:  [&lt;6004ef5e&gt;] flush_work+0x0/0x1d7
62031c18:  [&lt;60050234&gt;] try_to_grab_pending+0x0/0x17e
62031c38:  [&lt;6004e984&gt;] get_work_gcwq+0x71/0x8f
62031c48:  [&lt;60050539&gt;] __cancel_work_timer+0x5b/0x115
62031c78:  [&lt;628acc85&gt;] unplug_port+0x0/0x191 [virtio_console]
62031c98:  [&lt;6005061c&gt;] cancel_work_sync+0x12/0x14
62031ca8:  [&lt;628ace96&gt;] virtcons_remove+0x80/0x15c [virtio_console]
62031ce8:  [&lt;628191de&gt;] virtio_dev_remove+0x1e/0x7e [virtio]
62031d08:  [&lt;601cf242&gt;] __device_release_driver+0x75/0xe4
62031d28:  [&lt;601cf2dd&gt;] device_release_driver+0x2c/0x40
62031d48:  [&lt;601ce0dd&gt;] driver_unbind+0x7d/0xc6
62031d88:  [&lt;601cd5d9&gt;] drv_attr_store+0x27/0x29
62031d98:  [&lt;60115f61&gt;] sysfs_write_file+0x100/0x14d
62031df8:  [&lt;600b737d&gt;] vfs_write+0xcb/0x184
62031e08:  [&lt;600b58b8&gt;] filp_close+0x88/0x94
62031e38:  [&lt;600b7686&gt;] sys_write+0x59/0x88
62031e88:  [&lt;6001ced1&gt;] handle_syscall+0x5d/0x80
62031ea8:  [&lt;60030a74&gt;] userspace+0x405/0x531
62031f08:  [&lt;600d32cc&gt;] sys_dup+0x0/0x5e
62031f28:  [&lt;601b11d6&gt;] strcpy+0x0/0x18
62031f38:  [&lt;600be46c&gt;] do_execve+0x10/0x12
62031f48:  [&lt;600184c7&gt;] run_init_process+0x43/0x45
62031fd8:  [&lt;60019a91&gt;] new_thread_handler+0xba/0xbc

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
