<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/uio, branch v4.14.263</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-11-18T17:27:58+00:00</updated>
<entry>
<title>uio: Fix use-after-free in uio_unregister_device()</title>
<updated>2020-11-18T17:27:58+00:00</updated>
<author>
<name>Shin'ichiro Kawasaki</name>
<email>shinichiro.kawasaki@wdc.com</email>
</author>
<published>2020-11-02T12:28:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fb50a5ddc506f5dda513010165853eec67674507'/>
<id>urn:sha1:fb50a5ddc506f5dda513010165853eec67674507</id>
<content type='text'>
commit 092561f06702dd4fdd7fb74dd3a838f1818529b7 upstream.

Commit 8fd0e2a6df26 ("uio: free uio id after uio file node is freed")
triggered KASAN use-after-free failure at deletion of TCM-user
backstores [1].

In uio_unregister_device(), struct uio_device *idev is passed to
uio_free_minor() to refer idev-&gt;minor. However, before uio_free_minor()
call, idev is already freed by uio_device_release() during call to
device_unregister().

To avoid reference to idev-&gt;minor after idev free, keep idev-&gt;minor
value in a local variable. Also modify uio_free_minor() argument to
receive the value.

[1]
BUG: KASAN: use-after-free in uio_unregister_device+0x166/0x190
Read of size 4 at addr ffff888105196508 by task targetcli/49158

CPU: 3 PID: 49158 Comm: targetcli Not tainted 5.10.0-rc1 #1
Hardware name: Supermicro Super Server/X10SRL-F, BIOS 2.0 12/17/2015
Call Trace:
 dump_stack+0xae/0xe5
 ? uio_unregister_device+0x166/0x190
 print_address_description.constprop.0+0x1c/0x210
 ? uio_unregister_device+0x166/0x190
 ? uio_unregister_device+0x166/0x190
 kasan_report.cold+0x37/0x7c
 ? kobject_put+0x80/0x410
 ? uio_unregister_device+0x166/0x190
 uio_unregister_device+0x166/0x190
 tcmu_destroy_device+0x1c4/0x280 [target_core_user]
 ? tcmu_release+0x90/0x90 [target_core_user]
 ? __mutex_unlock_slowpath+0xd6/0x5d0
 target_free_device+0xf3/0x2e0 [target_core_mod]
 config_item_cleanup+0xea/0x210
 configfs_rmdir+0x651/0x860
 ? detach_groups.isra.0+0x380/0x380
 vfs_rmdir.part.0+0xec/0x3a0
 ? __lookup_hash+0x20/0x150
 do_rmdir+0x252/0x320
 ? do_file_open_root+0x420/0x420
 ? strncpy_from_user+0xbc/0x2f0
 ? getname_flags.part.0+0x8e/0x450
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f9e2bfc91fb
Code: 73 01 c3 48 8b 0d 9d ec 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 54 00 00 00 0f 05 &lt;48&gt; 3d 01 f0 ff ff 73 01 c3 48 8b 0d 6d ec 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007ffdd2baafe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000054
RAX: ffffffffffffffda RBX: 00007f9e2beb44a0 RCX: 00007f9e2bfc91fb
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f9e1c20be90
RBP: 00007ffdd2bab000 R08: 0000000000000000 R09: 00007f9e2bdf2440
R10: 00007ffdd2baaf37 R11: 0000000000000246 R12: 00000000ffffff9c
R13: 000055f9abb7e390 R14: 000055f9abcf9558 R15: 00007f9e2be7a780

Allocated by task 34735:
 kasan_save_stack+0x1b/0x40
 __kasan_kmalloc.constprop.0+0xc2/0xd0
 __uio_register_device+0xeb/0xd40
 tcmu_configure_device+0x5a0/0xbc0 [target_core_user]
 target_configure_device+0x12f/0x760 [target_core_mod]
 target_dev_enable_store+0x32/0x50 [target_core_mod]
 configfs_write_file+0x2bb/0x450
 vfs_write+0x1ce/0x610
 ksys_write+0xe9/0x1b0
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 49158:
 kasan_save_stack+0x1b/0x40
 kasan_set_track+0x1c/0x30
 kasan_set_free_info+0x1b/0x30
 __kasan_slab_free+0x110/0x150
 slab_free_freelist_hook+0x5a/0x170
 kfree+0xc6/0x560
 device_release+0x9b/0x210
 kobject_put+0x13e/0x410
 uio_unregister_device+0xf9/0x190
 tcmu_destroy_device+0x1c4/0x280 [target_core_user]
 target_free_device+0xf3/0x2e0 [target_core_mod]
 config_item_cleanup+0xea/0x210
 configfs_rmdir+0x651/0x860
 vfs_rmdir.part.0+0xec/0x3a0
 do_rmdir+0x252/0x320
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888105196000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1288 bytes inside of
 2048-byte region [ffff888105196000, ffff888105196800)
The buggy address belongs to the page:
page:0000000098e6ca81 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105190
head:0000000098e6ca81 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x17ffffc0010200(slab|head)
raw: 0017ffffc0010200 dead000000000100 dead000000000122 ffff888100043040
raw: 0000000000000000 0000000000080008 00000001ffffffff ffff88810eb55c01
page dumped because: kasan: bad access detected
page-&gt;mem_cgroup:ffff88810eb55c01

Memory state around the buggy address:
 ffff888105196400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888105196480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
&gt;ffff888105196500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888105196580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888105196600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Fixes: 8fd0e2a6df26 ("uio: free uio id after uio file node is freed")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Shin'ichiro Kawasaki &lt;shinichiro.kawasaki@wdc.com&gt;
Link: https://lore.kernel.org/r/20201102122819.2346270-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>uio: free uio id after uio file node is freed</title>
<updated>2020-11-05T10:06:55+00:00</updated>
<author>
<name>Lang Dai</name>
<email>lang.dai@intel.com</email>
</author>
<published>2020-09-14T03:26:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=290dafecde1d34c79fc79a8a6a7666ee2a66e0b6'/>
<id>urn:sha1:290dafecde1d34c79fc79a8a6a7666ee2a66e0b6</id>
<content type='text'>
[ Upstream commit 8fd0e2a6df262539eaa28b0a2364cca10d1dc662 ]

uio_register_device() do two things.
1) get an uio id from a global pool, e.g. the id is &lt;A&gt;
2) create file nodes like /sys/class/uio/uio&lt;A&gt;

uio_unregister_device() do two things.
1) free the uio id &lt;A&gt; and return it to the global pool
2) free the file node /sys/class/uio/uio&lt;A&gt;

There is a situation is that one worker is calling uio_unregister_device(),
and another worker is calling uio_register_device().
If the two workers are X and Y, they go as below sequence,
1) X free the uio id &lt;AAA&gt;
2) Y get an uio id &lt;AAA&gt;
3) Y create file node /sys/class/uio/uio&lt;AAA&gt;
4) X free the file note /sys/class/uio/uio&lt;AAA&gt;
Then it will failed at the 3rd step and cause the phenomenon we saw as it
is creating a duplicated file node.

Failure reports as follows:
sysfs: cannot create duplicate filename '/class/uio/uio10'
Call Trace:
   sysfs_do_create_link_sd.isra.2+0x9e/0xb0
   sysfs_create_link+0x25/0x40
   device_add+0x2c4/0x640
   __uio_register_device+0x1c5/0x576 [uio]
   adf_uio_init_bundle_dev+0x231/0x280 [intel_qat]
   adf_uio_register+0x1c0/0x340 [intel_qat]
   adf_dev_start+0x202/0x370 [intel_qat]
   adf_dev_start_async+0x40/0xa0 [intel_qat]
   process_one_work+0x14d/0x410
   worker_thread+0x4b/0x460
   kthread+0x105/0x140
 ? process_one_work+0x410/0x410
 ? kthread_bind+0x40/0x40
 ret_from_fork+0x1f/0x40
 Code: 85 c0 48 89 c3 74 12 b9 00 10 00 00 48 89 c2 31 f6 4c 89 ef
 e8 ec c4 ff ff 4c 89 e2 48 89 de 48 c7 c7 e8 b4 ee b4 e8 6a d4 d7
 ff &lt;0f&gt; 0b 48 89 df e8 20 fa f3 ff 5b 41 5c 41 5d 5d c3 66 0f 1f 84
---[ end trace a7531c1ed5269e84 ]---
 c6xxvf b002:00:00.0: Failed to register UIO devices
 c6xxvf b002:00:00.0: Failed to register UIO devices

Signed-off-by: Lang Dai &lt;lang.dai@intel.com&gt;

Link: https://lore.kernel.org/r/1600054002-17722-1-git-send-email-lang.dai@intel.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_pdrv_genirq: fix use without device tree and no interrupt</title>
<updated>2020-07-22T07:22:27+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=8ef1216a9ed682fe1a02bdc8694d83711022d158'/>
<id>urn:sha1:8ef1216a9ed682fe1a02bdc8694d83711022d158</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-28T15:35:57+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=0151b03f43f2d295a6949454434074b34a262e06'/>
<id>urn:sha1:0151b03f43f2d295a6949454434074b34a262e06</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>driver: uio: fix possible use-after-free in __uio_register_device</title>
<updated>2020-01-27T13:46:15+00:00</updated>
<author>
<name>Liu Jian</name>
<email>liujian56@huawei.com</email>
</author>
<published>2019-01-22T22:45:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=548752cabfaaf3945f2da9d202e70015c2991e9a'/>
<id>urn:sha1:548752cabfaaf3945f2da9d202e70015c2991e9a</id>
<content type='text'>
[ Upstream commit 221a1f4ac12d2ab46246c160b2e00d1b1160d5d9 ]

In uio_dev_add_attributes() error handing case, idev is used after
device_unregister(), in which 'idev' has been released, touch idev cause
use-after-free.

Fixes: a93e7b331568 ("uio: Prevent device destruction while fds are open")
Signed-off-by: Liu Jian &lt;liujian56@huawei.com&gt;
Reviewed-by: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
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>driver: uio: fix possible memory leak in __uio_register_device</title>
<updated>2020-01-27T13:46:15+00:00</updated>
<author>
<name>Liu Jian</name>
<email>liujian56@huawei.com</email>
</author>
<published>2019-01-22T22:45:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1b97b03ace9e5f2d84dba9e8e347e76cfda40dbf'/>
<id>urn:sha1:1b97b03ace9e5f2d84dba9e8e347e76cfda40dbf</id>
<content type='text'>
[ Upstream commit 1a392b3de7c5747506b38fc14b2e79977d3c7770 ]

'idev' is malloced in __uio_register_device() and leak free it before
leaving from the uio_get_minor() error handing case, it will cause
memory leak.

Fixes: a93e7b331568 ("uio: Prevent device destruction while fds are open")
Signed-off-by: Liu Jian &lt;liujian56@huawei.com&gt;
Reviewed-by: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
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>Revert "uio: use request_threaded_irq instead"</title>
<updated>2019-02-15T07:09:14+00:00</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2019-02-13T16:29:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f142573d9cb63ccbcfc311ce5c997191b1df55e9'/>
<id>urn:sha1:f142573d9cb63ccbcfc311ce5c997191b1df55e9</id>
<content type='text'>
commit 3d27c4de8d4fb2d4099ff324671792aa2578c6f9 upstream.

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;
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.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>2019-02-15T07:09:14+00:00</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2019-02-13T16:29:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5d07d245cb418064561c1a4e57313cf0a9132aa6'/>
<id>urn:sha1:5d07d245cb418064561c1a4e57313cf0a9132aa6</id>
<content type='text'>
commit b34e9a15b37b8ddbf06a4da142b0c39c74211eb4 upstream.

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;
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.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>2019-02-15T07:09:14+00:00</updated>
<author>
<name>Hailong Liu</name>
<email>liu.hailong6@zte.com.cn</email>
</author>
<published>2019-02-13T16:29:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28c618abeee3380a4ead50fe9863b692dd851e07'/>
<id>urn:sha1:28c618abeee3380a4ead50fe9863b692dd851e07</id>
<content type='text'>
commit e7de2590f18a272e63732b9d519250d1b522b2c4 upstream.

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;
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: fix crash after the device is unregistered</title>
<updated>2019-02-15T07:09:14+00:00</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2019-02-13T16:29:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=13af019c87f2d90e663742cb1a819834048842ae'/>
<id>urn:sha1:13af019c87f2d90e663742cb1a819834048842ae</id>
<content type='text'>
commit 57c5f4df0a5a0ee83df799991251e2ee93a5e4e9 upstream.

For the target_core_user use case, after the device is unregistered
it maybe still opened in user space, then the kernel will crash, like:

[  251.163692] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[  251.163820] IP: [&lt;ffffffffc0736213&gt;] show_name+0x23/0x40 [uio]
[  251.163965] PGD 8000000062694067 PUD 62696067 PMD 0
[  251.164097] Oops: 0000 [#1] SMP
...
[  251.165605]  e1000 mptscsih mptbase drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
[  251.166014] CPU: 0 PID: 13380 Comm: tcmu-runner Kdump: loaded Not tainted 3.10.0-916.el7.test.x86_64 #1
[  251.166381] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
[  251.166747] task: ffff971eb91db0c0 ti: ffff971e9e384000 task.ti: ffff971e9e384000
[  251.167137] RIP: 0010:[&lt;ffffffffc0736213&gt;]  [&lt;ffffffffc0736213&gt;] show_name+0x23/0x40 [uio]
[  251.167563] RSP: 0018:ffff971e9e387dc8  EFLAGS: 00010282
[  251.167978] RAX: 0000000000000000 RBX: ffff971e9e3f8000 RCX: ffff971eb8368d98
[  251.168408] RDX: ffff971e9e3f8000 RSI: ffffffffc0738084 RDI: ffff971e9e3f8000
[  251.168856] RBP: ffff971e9e387dd0 R08: ffff971eb8bc0018 R09: 0000000000000000
[  251.169296] R10: 0000000000001000 R11: ffffffffa09d444d R12: ffffffffa1076e80
[  251.169750] R13: ffff971e9e387f18 R14: 0000000000000001 R15: ffff971e9cfb1c80
[  251.170213] FS:  00007ff37d175880(0000) GS:ffff971ebb600000(0000) knlGS:0000000000000000
[  251.170693] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  251.171248] CR2: 0000000000000008 CR3: 00000000001f6000 CR4: 00000000003607f0
[  251.172071] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  251.172640] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  251.173236] Call Trace:
[  251.173789]  [&lt;ffffffffa0c9b2d3&gt;] dev_attr_show+0x23/0x60
[  251.174356]  [&lt;ffffffffa0f561b2&gt;] ? mutex_lock+0x12/0x2f
[  251.174892]  [&lt;ffffffffa0ac6d9f&gt;] sysfs_kf_seq_show+0xcf/0x1f0
[  251.175433]  [&lt;ffffffffa0ac54e6&gt;] kernfs_seq_show+0x26/0x30
[  251.175981]  [&lt;ffffffffa0a63be0&gt;] seq_read+0x110/0x3f0
[  251.176609]  [&lt;ffffffffa0ac5d45&gt;] kernfs_fop_read+0xf5/0x160
[  251.177158]  [&lt;ffffffffa0a3d3af&gt;] vfs_read+0x9f/0x170
[  251.177707]  [&lt;ffffffffa0a3e27f&gt;] SyS_read+0x7f/0xf0
[  251.178268]  [&lt;ffffffffa0f648af&gt;] system_call_fastpath+0x1c/0x21
[  251.178823] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 53 48 89 d3 e8 7e 96 56 e0 48 8b 80 d8 02 00 00 48 89 df 48 c7 c6 84 80 73 c0 &lt;48&gt; 8b 50 08 31 c0 e8 e2 67 44 e0 5b 48 98 5d c3 0f 1f 00 66 2e
[  251.180115] RIP  [&lt;ffffffffc0736213&gt;] show_name+0x23/0x40 [uio]
[  251.180820]  RSP &lt;ffff971e9e387dc8&gt;
[  251.181473] CR2: 0000000000000008

CC: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
CC: Mike Christie &lt;mchristi@redhat.com&gt;
Reviewed-by: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
Signed-off-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
