isert-scst: Enable copying to user space from isert_cmnd_cache

This patch fixes warning with call trace that occurs during
copy_to_user() from isert_read():

usercopy: Kernel memory exposure attempt detected from SLUB object 'sgv-clust-64K' (offset 200, size 48)!
------------[ cut here ]------------
kernel BUG at mm/usercopy.c:99!
...
RIP: 0010:usercopy_abort+0x7b/0x7d
Call Trace:
 __check_heap_object+0xdf/0x110
 __check_object_size.part.0+0x128/0x150
 __check_object_size+0x1c/0x20
 isert_read+0x10b/0x380 [isert_scst]
 ? security_file_permission+0x96/0x160
 vfs_read+0x9f/0x190
 ksys_read+0x67/0xe0
 __x64_sys_read+0x19/0x20
 do_syscall_64+0x61/0xb0
 ? __x64_sys_sendto+0x24/0x30
 ? do_syscall_64+0x6e/0xb0
 ? exit_to_user_mode_prepare+0x37/0xb0
 ? syscall_exit_to_user_mode+0x27/0x50
 ? do_syscall_64+0x6e/0xb0
 ? asm_exc_page_fault+0x8/0x30
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Signed-off-by: Morozov Ilia <morozov.i@raidix.com>
This commit is contained in:
Chesnokov Gleb
2021-12-16 00:43:44 +03:00
committed by Gleb Chesnokov
parent 475970f66a
commit 50d607a336
+3 -2
View File
@@ -144,8 +144,9 @@ int isert_global_init(void)
return -ENOMEM;
}
isert_cmnd_cache = KMEM_CACHE(isert_cmnd,
SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN);
isert_cmnd_cache = KMEM_CACHE_USERCOPY(isert_cmnd,
SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN,
iscsi);
if (!isert_cmnd_cache) {
destroy_workqueue(isert_glob.conn_wq);
PRINT_ERROR("Failed to alloc iser command cache");