<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/uio, branch v4.19.77</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.77</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.77'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-11-27T15:13:09+00:00</updated>
<entry>
<title>uio: Fix an Oops on load</title>
<updated>2018-11-27T15:13:09+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-10-26T07:19:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8600660ce149b32961d0f298eb6cd1c22a161fb1'/>
<id>urn:sha1:8600660ce149b32961d0f298eb6cd1c22a161fb1</id>
<content type='text'>
commit 432798195bbce1f8cd33d1c0284d0538835e25fb upstream.

I was trying to solve a double free but I introduced a more serious
NULL dereference bug.  The problem is that if there is an IRQ which
triggers immediately, then we need "info-&gt;uio_dev" but it's not set yet.

This patch puts the original initialization back to how it was and just
sets info-&gt;uio_dev to NULL on the error path so it should solve both
the Oops and the double free.

Fixes: f019f07ecf6a ("uio: potential double frees if __uio_register_device() fails")
Reported-by: Mathias Thore &lt;Mathias.Thore@infinera.com&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Tested-by: Mathias Thore &lt;Mathias.Thore@infinera.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>uio: ensure class is registered before devices</title>
<updated>2018-11-13T19:08:37+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2018-08-16T07:39:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c21099be02331a82c28a7bad1d956b6cd64a3782'/>
<id>urn:sha1:c21099be02331a82c28a7bad1d956b6cd64a3782</id>
<content type='text'>
[ Upstream commit ae61cf5b9913027c6953a79ed3894da4f47061bd ]

When both uio and the uio drivers are built in the kernel, it is possible
for a driver to register devices before the uio class is registered.

This may result in a NULL pointer dereference later on in
get_device_parent() when accessing the class glue_dirs spinlock.

The trace looks like that:

Unable to handle kernel NULL pointer dereference at virtual address 00000140
[...]
[&lt;ffff0000089cc234&gt;] _raw_spin_lock+0x14/0x48
[&lt;ffff0000084f56bc&gt;] device_add+0x154/0x6a0
[&lt;ffff0000084f5e48&gt;] device_create_groups_vargs+0x120/0x128
[&lt;ffff0000084f5edc&gt;] device_create+0x54/0x60
[&lt;ffff0000086e72c0&gt;] __uio_register_device+0x120/0x4a8
[&lt;ffff000008528b7c&gt;] jaguar2_pci_probe+0x2d4/0x558
[&lt;ffff0000083fc18c&gt;] local_pci_probe+0x3c/0xb8
[&lt;ffff0000083fd81c&gt;] pci_device_probe+0x11c/0x180
[&lt;ffff0000084f88bc&gt;] driver_probe_device+0x22c/0x2d8
[&lt;ffff0000084f8a24&gt;] __driver_attach+0xbc/0xc0
[&lt;ffff0000084f69fc&gt;] bus_for_each_dev+0x4c/0x98
[&lt;ffff0000084f81b8&gt;] driver_attach+0x20/0x28
[&lt;ffff0000084f7d08&gt;] bus_add_driver+0x1b8/0x228
[&lt;ffff0000084f93c0&gt;] driver_register+0x60/0xf8
[&lt;ffff0000083fb918&gt;] __pci_register_driver+0x40/0x48

Return EPROBE_DEFER in that case so the driver can register the device
later.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc</title>
<updated>2018-08-19T16:30:44+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2018-08-19T16:30:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1d0926e99de7b486321e3db924b445531eea5e18'/>
<id>urn:sha1:1d0926e99de7b486321e3db924b445531eea5e18</id>
<content type='text'>
Pull UIO fix from Greg KH:
 "Here is a single UIO fix that I forgot to send before 4.18-final came
  out. It reverts a UIO patch that went in the 4.18 development window
  that was causing problems.

  This patch has been in linux-next for a while with no problems, I just
  forgot to send it earlier, or as part of the larger char/misc patch
  series from yesterday, my fault"

* tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  Revert "uio: use request_threaded_irq instead"
</content>
</entry>
<entry>
<title>Revert "uio: use request_threaded_irq instead"</title>
<updated>2018-08-12T15:30:58+00:00</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2018-08-12T11:58:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3d27c4de8d4fb2d4099ff324671792aa2578c6f9'/>
<id>urn:sha1:3d27c4de8d4fb2d4099ff324671792aa2578c6f9</id>
<content type='text'>
Since mutex lock in irq hanler is useless currently, here will
remove it together with it.

This reverts commit 9421e45f5ff3d558cf8b75a8cc0824530caf3453.

Reported-by: james.r.harris@intel.com
CC: Ahsan Atta &lt;ahsan.atta@intel.com&gt;
Signed-off-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: potential double frees if __uio_register_device() fails</title>
<updated>2018-08-02T08:42:25+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-08-02T08:24:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f019f07ecf6a6b8bd6d7853bce70925d90af02d1'/>
<id>urn:sha1:f019f07ecf6a6b8bd6d7853bce70925d90af02d1</id>
<content type='text'>
The uio_unregister_device() function assumes that if "info-&gt;uio_dev" is
non-NULL that means "info" is fully allocated.  Setting info-&gt;uio_de
has to be the last thing in the function.

In the current code, if request_threaded_irq() fails then we return with
info-&gt;uio_dev set to non-NULL but info is not fully allocated and it can
lead to double frees.

Fixes: beafc54c4e2f ("UIO: Add the User IO core code")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: fix possible circular locking dependency</title>
<updated>2018-08-02T08:14:26+00:00</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2018-07-30T07:11:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b34e9a15b37b8ddbf06a4da142b0c39c74211eb4'/>
<id>urn:sha1:b34e9a15b37b8ddbf06a4da142b0c39c74211eb4</id>
<content type='text'>
The call trace:
XXX/1910 is trying to acquire lock:
 (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;ffffffff97008c87&gt;] might_fault+0x57/0xb0

but task is already holding lock:
 (&amp;idev-&gt;info_lock){+.+...}, at: [&lt;ffffffffc0638a06&gt;] uio_write+0x46/0x130 [uio]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;idev-&gt;info_lock){+.+...}:
       [&lt;ffffffff96f31fc9&gt;] lock_acquire+0x99/0x1e0
       [&lt;ffffffff975edad3&gt;] mutex_lock_nested+0x93/0x410
       [&lt;ffffffffc063873d&gt;] uio_mmap+0x2d/0x170 [uio]
       [&lt;ffffffff97016b58&gt;] mmap_region+0x428/0x650
       [&lt;ffffffff97017138&gt;] do_mmap+0x3b8/0x4e0
       [&lt;ffffffff96ffaba3&gt;] vm_mmap_pgoff+0xd3/0x120
       [&lt;ffffffff97015261&gt;] SyS_mmap_pgoff+0x1f1/0x270
       [&lt;ffffffff96e387c2&gt;] SyS_mmap+0x22/0x30
       [&lt;ffffffff975ff315&gt;] system_call_fastpath+0x1c/0x21

-&gt; #0 (&amp;mm-&gt;mmap_sem){++++++}:
       [&lt;ffffffff96f30e9c&gt;] __lock_acquire+0xdac/0x15f0
       [&lt;ffffffff96f31fc9&gt;] lock_acquire+0x99/0x1e0
       [&lt;ffffffff97008cb4&gt;] might_fault+0x84/0xb0
       [&lt;ffffffffc0638a74&gt;] uio_write+0xb4/0x130 [uio]
       [&lt;ffffffff9706ffa3&gt;] vfs_write+0xc3/0x1f0
       [&lt;ffffffff97070e2a&gt;] SyS_write+0x8a/0x100
       [&lt;ffffffff975ff315&gt;] system_call_fastpath+0x1c/0x21

other info that might help us debug this:
 Possible unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&amp;idev-&gt;info_lock);
                               lock(&amp;mm-&gt;mmap_sem);
                               lock(&amp;idev-&gt;info_lock);
  lock(&amp;mm-&gt;mmap_sem);

 *** DEADLOCK ***
1 lock held by XXX/1910:
 #0:  (&amp;idev-&gt;info_lock){+.+...}, at: [&lt;ffffffffc0638a06&gt;] uio_write+0x46/0x130 [uio]

stack backtrace:
CPU: 0 PID: 1910 Comm: XXX Kdump: loaded Not tainted #1
Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
Call Trace:
 [&lt;ffffffff975e9211&gt;] dump_stack+0x19/0x1b
 [&lt;ffffffff975e260a&gt;] print_circular_bug+0x1f9/0x207
 [&lt;ffffffff96f2f6a7&gt;] check_prevs_add+0x957/0x960
 [&lt;ffffffff96f30e9c&gt;] __lock_acquire+0xdac/0x15f0
 [&lt;ffffffff96f2fb19&gt;] ? mark_held_locks+0xb9/0x140
 [&lt;ffffffff96f31fc9&gt;] lock_acquire+0x99/0x1e0
 [&lt;ffffffff97008c87&gt;] ? might_fault+0x57/0xb0
 [&lt;ffffffff97008cb4&gt;] might_fault+0x84/0xb0
 [&lt;ffffffff97008c87&gt;] ? might_fault+0x57/0xb0
 [&lt;ffffffffc0638a74&gt;] uio_write+0xb4/0x130 [uio]
 [&lt;ffffffff9706ffa3&gt;] vfs_write+0xc3/0x1f0
 [&lt;ffffffff9709349c&gt;] ? fget_light+0xfc/0x510
 [&lt;ffffffff97070e2a&gt;] SyS_write+0x8a/0x100
 [&lt;ffffffff975ff315&gt;] system_call_fastpath+0x1c/0x21

Signed-off-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: pruss: fix error handling in probe</title>
<updated>2018-08-02T08:14:26+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-08-02T07:15:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=95883676e34ab93f600787cc9831707bcdad4398'/>
<id>urn:sha1:95883676e34ab93f600787cc9831707bcdad4398</id>
<content type='text'>
There are two bugs here.  First the error codes weren't set on several
paths.  And second, if the call to request_threaded_irq() inside
uio_register_device() fails then it would lead to a double free when
we call uio_unregister_device() inside pruss_cleanup().

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: add SPDX license tags</title>
<updated>2018-07-21T13:41:20+00:00</updated>
<author>
<name>Stephen Hemminger</name>
<email>stephen@networkplumber.org</email>
</author>
<published>2018-07-21T13:31:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bce5c2ea350f5a57353295534faba00b28cadf14'/>
<id>urn:sha1:bce5c2ea350f5a57353295534faba00b28cadf14</id>
<content type='text'>
For those without any license text present or short reference
to GPL, add SPDX tag.

Signed-off-by: Stephen Hemminger &lt;sthemmin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: fix wrong return value from uio_mmap()</title>
<updated>2018-07-21T06:45:24+00:00</updated>
<author>
<name>Hailong Liu</name>
<email>liu.hailong6@zte.com.cn</email>
</author>
<published>2018-07-20T00:31:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e7de2590f18a272e63732b9d519250d1b522b2c4'/>
<id>urn:sha1:e7de2590f18a272e63732b9d519250d1b522b2c4</id>
<content type='text'>
uio_mmap has multiple fail paths to set return value to nonzero then
goto out. However, it always returns *0* from the *out* at end, and
this will mislead callers who check the return value of this function.

Fixes: 57c5f4df0a5a0ee ("uio: fix crash after the device is unregistered")
CC: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Hailong Liu &lt;liu.hailong6@zte.com.cn&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jiang Biao &lt;jiang.biao2@zte.com.cn&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: add SPDX license tag</title>
<updated>2018-07-21T06:44:08+00:00</updated>
<author>
<name>Stephen Hemminger</name>
<email>stephen@networkplumber.org</email>
</author>
<published>2018-07-20T22:11:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fbb5858c1467ef8feccc910ac9e9f529186a9f9d'/>
<id>urn:sha1:fbb5858c1467ef8feccc910ac9e9f529186a9f9d</id>
<content type='text'>
Replace short statement in comment with proper SPDX
license tag.

Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
