<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/uio, branch v4.4.235</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-07-22T07:10:07+00:00</updated>
<entry>
<title>uio_pdrv_genirq: fix use without device tree and no interrupt</title>
<updated>2020-07-22T07:10:07+00:00</updated>
<author>
<name>Esben Haabendal</name>
<email>esben@geanix.com</email>
</author>
<published>2020-07-01T14:56:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=89339d38cfa3df57a88f7a80d326c0d915bc192c'/>
<id>urn:sha1:89339d38cfa3df57a88f7a80d326c0d915bc192c</id>
<content type='text'>
commit bf12fdf0ab728ca8e5933aac46dd972c0dd0421e upstream.

While e3a3c3a20555 ("UIO: fix uio_pdrv_genirq with device tree but no
interrupt") added support for using uio_pdrv_genirq for devices without
interrupt for device tree platforms, the removal of uio_pdrv in
26dac3c49d56 ("uio: Remove uio_pdrv and use uio_pdrv_genirq instead")
broke the support for non device tree platforms.

This change fixes this, so that uio_pdrv_genirq can be used without
interrupt on all platforms.

This still leaves the support that uio_pdrv had for custom interrupt
handler lacking, as uio_pdrv_genirq does not handle it (yet).

Fixes: 26dac3c49d56 ("uio: Remove uio_pdrv and use uio_pdrv_genirq instead")
Signed-off-by: Esben Haabendal &lt;esben@geanix.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200701145659.3978-3-esben@geanix.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol()</title>
<updated>2020-02-28T14:38:54+00:00</updated>
<author>
<name>Jia-Ju Bai</name>
<email>baijiaju1990@gmail.com</email>
</author>
<published>2019-12-18T09:44:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4a117a1c581623d04bf09aa7455d8e7b66e8bb85'/>
<id>urn:sha1:4a117a1c581623d04bf09aa7455d8e7b66e8bb85</id>
<content type='text'>
[ Upstream commit b74351287d4bd90636c3f48bc188c2f53824c2d4 ]

The driver may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:

kernel/irq/manage.c, 523:
	synchronize_irq in disable_irq
drivers/uio/uio_dmem_genirq.c, 140:
	disable_irq in uio_dmem_genirq_irqcontrol
drivers/uio/uio_dmem_genirq.c, 134:
	_raw_spin_lock_irqsave in uio_dmem_genirq_irqcontrol

synchronize_irq() can sleep at runtime.

To fix this bug, disable_irq() is called without holding the spinlock.

This bug is found by a static analysis tool STCheck written by myself.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@gmail.com&gt;
Link: https://lore.kernel.org/r/20191218094405.6009-1-baijiaju1990@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>uio: Fix an Oops on load</title>
<updated>2018-11-27T15:08:02+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=1582f07e886d94a2d214b4978de740205f469cdd'/>
<id>urn:sha1:1582f07e886d94a2d214b4978de740205f469cdd</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-21T08:27:33+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=2d62826e4bd58417f1e1b6e64f2fcbc950a12b07'/>
<id>urn:sha1:2d62826e4bd58417f1e1b6e64f2fcbc950a12b07</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>uio: potential double frees if __uio_register_device() fails</title>
<updated>2018-09-19T20:48:57+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=57533bacbc5606d12322dbb738f5f335fc835c33'/>
<id>urn:sha1:57533bacbc5606d12322dbb738f5f335fc835c33</id>
<content type='text'>
[ Upstream commit f019f07ecf6a6b8bd6d7853bce70925d90af02d1 ]

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;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: fix dmem_region_start computation</title>
<updated>2016-10-31T10:13:59+00:00</updated>
<author>
<name>Jan Viktorin</name>
<email>viktorin@rehivetech.com</email>
</author>
<published>2016-05-17T09:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d0842a484407d6d470e57dff30e414f365af1ad'/>
<id>urn:sha1:4d0842a484407d6d470e57dff30e414f365af1ad</id>
<content type='text'>
commit 4d31a2588ae37a5d0f61f4d956454e9504846aeb upstream.

The variable i contains a total number of resources (including
IORESOURCE_IRQ). However, we want the dmem_region_start to point
after the last resource of type IORESOURCE_MEM. The original behaviour
leads (very likely) to skipping several UIO mapping regions and makes
them useless. Fix this by computing dmem_region_start from the uiomem
which points to the last used UIO mapping.

Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation")

Signed-off-by: Jan Viktorin &lt;viktorin@rehivetech.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>uio: fix false positive __might_sleep warning splat</title>
<updated>2015-10-04T11:32:25+00:00</updated>
<author>
<name>Michal Hocko</name>
<email>mhocko@suse.com</email>
</author>
<published>2015-09-07T07:21:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=edce5e6f33a365c879b453286191bf397cc5efb4'/>
<id>urn:sha1:edce5e6f33a365c879b453286191bf397cc5efb4</id>
<content type='text'>
Andy has reported a __might_sleep warning
[ 5174.883617] WARNING: CPU: 0 PID: 1532 at
/home/agrover/git/kernel/kernel/sched/core.c:7389 __might_sleep+0x7d/0x90()
[ 5174.884407] do not call blocking ops when !TASK_RUNNING; state=1 set at [&lt;ffffffffa02a5821&gt;] uio_read+0x91/0x170 [uio]
[ 5174.885198] Modules linked in: tcm_loop target_core_user uio target_core_pscsi target_core_file target_core_iblock iscsi_target_mod  target_core_mod uinput fuse nfsv3 nfs_acl nfs lockd grace fscache sunrpc microcode i2c_piix4 virtio_balloon i2c_core xfs libcrc32c crc32c_intel  virtio_net virtio_blk
[ 5174.887351] CPU: 0 PID: 1532 Comm: tcmu-runner Not tainted 4.2.0-rc7+
[ 5174.887853] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.8.1-20150318_183358- 04/01/2014
[ 5174.888633]  ffffffff81a3b870 ffff880045393ca8 ffffffff817afaae
0000000000000000
[ 5174.889224]  ffff880045393cf8 ffff880045393ce8 ffffffff8109a846
ffff880045393cd8
[ 5174.889793]  ffffffffa02a7150 00000000000002dc 0000000000000000
ffff880045008000
[ 5174.890375] Call Trace:
[ 5174.890562]  [&lt;ffffffff817afaae&gt;] dump_stack+0x4c/0x65
[ 5174.890938]  [&lt;ffffffff8109a846&gt;] warn_slowpath_common+0x86/0xc0
[ 5174.891388]  [&lt;ffffffff8109a8c6&gt;] warn_slowpath_fmt+0x46/0x50
[ 5174.891808]  [&lt;ffffffffa02a5821&gt;] ? uio_read+0x91/0x170 [uio]
[ 5174.892237]  [&lt;ffffffffa02a5821&gt;] ? uio_read+0x91/0x170 [uio]
[ 5174.892653]  [&lt;ffffffff810c584d&gt;] __might_sleep+0x7d/0x90
[ 5174.893055]  [&lt;ffffffff811ea023&gt;] __might_fault+0x43/0xa0
[ 5174.893448]  [&lt;ffffffff817b31ce&gt;] ? schedule+0x3e/0x90
[ 5174.893820]  [&lt;ffffffffa02a58c2&gt;] uio_read+0x132/0x170 [uio]
[ 5174.894240]  [&lt;ffffffff810cbb80&gt;] ? wake_up_q+0x70/0x70
[ 5174.894620]  [&lt;ffffffff81236168&gt;] __vfs_read+0x28/0xe0
[ 5174.894993]  [&lt;ffffffff81353233&gt;] ? security_file_permission+0xa3/0xc0
[ 5174.895541]  [&lt;ffffffff8123678f&gt;] ? rw_verify_area+0x4f/0xf0
[ 5174.896006]  [&lt;ffffffff812368ba&gt;] vfs_read+0x8a/0x140
[ 5174.896391]  [&lt;ffffffff817b28f5&gt;] ? __schedule+0x425/0xcc0
[ 5174.896788]  [&lt;ffffffff812375d9&gt;] SyS_read+0x49/0xb0

The warning is a false positive because uio_read doesn't depent on
TASK_INTERRUPTIBLE after copy_to_user so it is safe to silence the
warning by an explicit setting the state to TASK_RUNNING in the path
which might call into TASK_RUNNING.

Reported-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: uio_fsl_elbc_gpcm: Fix module autoload for OF platform driver</title>
<updated>2015-10-04T11:32:25+00:00</updated>
<author>
<name>Luis de Bethencourt</name>
<email>luis@debethencourt.com</email>
</author>
<published>2015-09-03T11:08:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0049ef9c8d44e46d042e463fb74e120efe7640f2'/>
<id>urn:sha1:0049ef9c8d44e46d042e463fb74e120efe7640f2</id>
<content type='text'>
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt &lt;luis@debethencourt.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: UIO_PRUSS should depend on HAS_DMA</title>
<updated>2015-08-05T20:25:59+00:00</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert@linux-m68k.org</email>
</author>
<published>2015-06-29T07:12:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=686079c9b71a4673d0068ea4538f22359070ee33'/>
<id>urn:sha1:686079c9b71a4673d0068ea4538f22359070ee33</id>
<content type='text'>
If NO_DMA=y:

    ERROR: "dma_alloc_coherent" [drivers/uio/uio_pruss.ko] undefined!
    ERROR: "dma_free_coherent" [drivers/uio/uio_pruss.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: uio_fsl_elbc_gpcm: Use module_platform_driver</title>
<updated>2015-08-05T20:25:59+00:00</updated>
<author>
<name>Vaishali Thakkar</name>
<email>vthakkar1994@gmail.com</email>
</author>
<published>2015-07-08T04:54:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d12f569c9b57ecdb18631d0b54c5224da5a1c233'/>
<id>urn:sha1:d12f569c9b57ecdb18631d0b54c5224da5a1c233</id>
<content type='text'>
Use module_platform_driver for drivers whose init and exit functions
only register and unregister, respectively.

A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:

@a@
identifier f, x;
@@
-static f(...) { return platform_driver_register(&amp;x); }

@b depends on a@
identifier e, a.x;
@@
-static e(...) { platform_driver_unregister(&amp;x); }

@c depends on a &amp;&amp; b@
identifier a.f;
declarer name module_init;
@@
-module_init(f);

@d depends on a &amp;&amp; b &amp;&amp; c@
identifier b.e, a.x;
declarer name module_exit;
declarer name module_platform_driver;
@@
-module_exit(e);
+module_platform_driver(x);

Signed-off-by: Vaishali Thakkar &lt;vthakkar1994@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
