<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/char, branch v3.4.61</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/char?h=v3.4.61</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/char?h=v3.4.61'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-08-15T05:57:07Z</updated>
<entry>
<title>virtio: console: return -ENODEV on all read operations after unplug</title>
<updated>2013-08-15T05:57:07Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:53:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a57425e942b49e729a62ccb4d420ae7c83762fe2'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>virtio: console: fix raising SIGIO after port unplug</title>
<updated>2013-08-15T05:57:07Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:51:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=183c6a6b4ec8efa1a862b07eb4523d8781ae3e44'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>virtio: console: clean up port data immediately at time of unplug</title>
<updated>2013-08-15T05:57:06Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:50:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9f92fafcadb619514dbab90882ddfe60245572cd'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>virtio: console: fix race in port_fops_open() and port unplug</title>
<updated>2013-08-15T05:57:06Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:47:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9c040cbf67c54c0eb67ebdc0424cfadd3d7a2a7a'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>virtio: console: fix race with port unplug and open/close</title>
<updated>2013-08-15T05:57:06Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-07-29T04:46:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d0bfaacabec9c87b739c31662eaa96af0d1b404c'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex</title>
<updated>2013-05-19T17:54:49Z</updated>
<author>
<name>Benjamin LaHaise</name>
<email>bcrl@kvack.org</email>
</author>
<published>2013-05-16T19:04:27Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=85e3025845566a5295bf91c514efb3fd640c1a56'/>
<id>urn:sha1:85e3025845566a5295bf91c514efb3fd640c1a56</id>
<content type='text'>
commit 6368087e851e697679af059b4247aca33a69cef3 upstream.

When a 32 bit version of ipmitool is used on a 64 bit kernel, the
ipmi_devintf code fails to correctly acquire ipmi_mutex.  This results in
incomplete data being retrieved in some cases, or other possible failures.
Add a wrapper around compat_ipmi_ioctl() to take ipmi_mutex to fix this.

Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Signed-off-by: Corey Minyard &lt;cminyard@mvista.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow</title>
<updated>2013-05-19T17:54:49Z</updated>
<author>
<name>Chen Gang</name>
<email>gang.chen@asianux.com</email>
</author>
<published>2013-05-16T19:04:25Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=65b904e51e44d998ea4a7e9e95e4f2a96754c936'/>
<id>urn:sha1:65b904e51e44d998ea4a7e9e95e4f2a96754c936</id>
<content type='text'>
commit a5f2b3d6a738e7d4180012fe7b541172f8c8dcea upstream.

When calling memcpy, read_data and write_data need additional 2 bytes.

  write_data:
    for checking:  "if (size &gt; IPMI_MAX_MSG_LENGTH)"
    for operating: "memcpy(bt-&gt;write_data + 3, data + 1, size - 1)"

  read_data:
    for checking:  "if (msg_len &lt; 3 || msg_len &gt; IPMI_MAX_MSG_LENGTH)"
    for operating: "memcpy(data + 2, bt-&gt;read_data + 4, msg_len - 2)"

Signed-off-by: Chen Gang &lt;gang.chen@asianux.com&gt;
Signed-off-by: Corey Minyard &lt;cminyard@mvista.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>vm: convert HPET mmap to vm_iomap_memory() helper</title>
<updated>2013-04-26T04:19:56Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2013-04-19T16:46:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5de41ebef9458aa13955c5a3792c2f86d6e4fdda'/>
<id>urn:sha1:5de41ebef9458aa13955c5a3792c2f86d6e4fdda</id>
<content type='text'>
commit 2323036dfec8ce3ce6e1c86a49a31b039f3300d1 upstream.

This is my example conversion of a few existing mmap users.  The HPET
case is simple, widely available, and easy to test (Clemens Ladisch sent
a trivial test-program for it).

Test-program-by: Clemens Ladisch &lt;clemens@ladisch.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>virtio: rng: disallow multiple device registrations, fixes crashes</title>
<updated>2013-03-20T20:04:57Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2013-03-08T00:30:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c8fba5853260c3114ed0a24f721cd4c415ea011c'/>
<id>urn:sha1:c8fba5853260c3114ed0a24f721cd4c415ea011c</id>
<content type='text'>
commit e84e7a56a3aa2963db506299e29a5f3f09377f9b upstream.

The code currently only supports one virtio-rng device at a time.
Invoking guests with multiple devices causes the guest to blow up.

Check if we've already registered and initialised the driver.  Also
cleanup in case of registration errors or hot-unplug so that a new
device can be used.

Reported-by: Peter Krempa &lt;pkrempa@redhat.com&gt;
Reported-by: &lt;yunzheng@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>
</entry>
<entry>
<title>hw_random: make buffer usable in scatterlist.</title>
<updated>2013-03-14T18:29:42Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2013-03-04T23:37:08Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=681e3b15fef858a9512d5fb2baceb85b0913385f'/>
<id>urn:sha1:681e3b15fef858a9512d5fb2baceb85b0913385f</id>
<content type='text'>
commit f7f154f1246ccc5a0a7e9ce50932627d60a0c878 upstream.

virtio_rng feeds the randomness buffer handed by the core directly
into the scatterlist, since commit bb347d98079a547e80bd4722dee1de61e4dca0e8.

However, if CONFIG_HW_RANDOM=m, the static buffer isn't a linear address
(at least on most archs).  We could fix this in virtio_rng, but it's actually
far easier to just do it in the core as virtio_rng would have to allocate
a buffer every time (it doesn't know how much the core will want to read).

Reported-by: Aurelien Jarno &lt;aurelien@aurel32.net&gt;
Tested-by: Aurelien Jarno &lt;aurelien@aurel32.net&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
