mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
1cd44e93ad915a0ec839746bc7b73ddc3e19afeb
Set *res_sg_cnt correctly in case the scatterlist is chained. Support chained scatterlists in the loop that calculates the number of bytes left. Fix restoring the original SG list in case an error happens: scst_check_restore_sg_buff() only restores the original sg list if cmd->sg_buff_modified has been set. However, __scst_adjust_sg_get_tail() does not set that variable. This patch fixes the following kernel complaints triggered by COMPARE AND WRITE (see also https://github.com/bvanassche/scst/issues/22): scst_adjust_sg_get_tail() failed: -22 WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/scst_lib.c:6860 scst_cwr_read_cmd_finished+0x954/0xb10 [scst] CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G O 5.7.0-rc4-dbg+ #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014 RIP: 0010:scst_cwr_read_cmd_finished+0x954/0xb10 [scst] Call Trace: scst_finish_internal_cmd+0x1f8/0x3c0 [scst] scst_process_active_cmd+0x594/0x17f0 [scst] scst_cmd_thread+0x470/0xc30 [scst] kthread+0x211/0x240 ret_from_fork+0x24/0x30 WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/../include/scst.h:5030 blockio_exec_rw+0xbb2/0xe00 [scst_vdisk] CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G W O 5.7.0-rc4-dbg+ #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014 RIP: 0010:blockio_exec_rw+0xbb2/0xe00 [scst_vdisk] Call Trace: blockio_exec_write+0x9c/0x160 [scst_vdisk] vdev_do_job+0xe8/0x290 [scst_vdisk] blockio_exec+0x153/0x4b0 [scst_vdisk] scst_do_real_exec+0xf4/0x680 [scst] scst_exec_check_blocking+0x24e/0x7b0 [scst] scst_exec_check_sn+0x252/0x7d0 [scst] scst_process_active_cmd+0x9a0/0x17f0 [scst] scst_cmd_thread+0x37e/0xc30 [scst] kthread+0x211/0x240 ret_from_fork+0x24/0x30 BUG: KASAN: slab-out-of-bounds in __scst_adjust_sg_get_tail+0x2da/0x550 [scst] Read of size 4 at addr ffff8881dd9b93cc by task disk011_0/1179 CPU: 3 PID: 1179 Comm: disk011_0 Tainted: G W O 5.7.0-rc4-dbg+ #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014 Call Trace: dump_stack+0xa5/0xe6 print_address_description.constprop.0+0x46/0x60 __kasan_report.cold+0x94/0xbb kasan_report+0x45/0x60 __asan_load4+0x6f/0x90 __scst_adjust_sg_get_tail+0x2da/0x550 [scst] scst_cwr_read_cmd_finished+0x574/0xb10 [scst] scst_finish_internal_cmd+0x1f8/0x3c0 [scst] scst_process_active_cmd+0x594/0x17f0 [scst] scst_cmd_thread+0x470/0xc30 [scst] kthread+0x211/0x240 ret_from_fork+0x24/0x30 Allocated by task 1549: save_stack+0x23/0x50 __kasan_kmalloc.constprop.0+0xcf/0xe0 kasan_slab_alloc+0x12/0x20 kmem_cache_alloc+0x101/0x370 mempool_alloc_slab+0x1b/0x20 mempool_alloc+0xf3/0x2b0 sg_pool_alloc+0x58/0xb0 __sg_alloc_table+0x14e/0x1c0 sg_alloc_table_chained+0x4f/0xf0 scsi_init_io+0x144/0x6d0 [scsi_mod] scsi_queue_rq+0xabc/0xe00 [scsi_mod] blk_mq_dispatch_rq_list+0x6ad/0xd10 __blk_mq_sched_dispatch_requests+0x1e9/0x2c0 blk_mq_sched_dispatch_requests+0x8e/0xc0 __blk_mq_run_hw_queue+0x128/0x1e0 __blk_mq_delay_run_hw_queue+0x2dd/0x310 blk_mq_run_hw_queue+0x145/0x1e0 blk_mq_sched_insert_request+0x236/0x360 blk_execute_rq_nowait+0x8e/0xa0 blk_execute_rq+0xe1/0x160 sg_io+0x43b/0x7a0 scsi_cmd_ioctl+0x27a/0x3e0 scsi_cmd_blk_ioctl+0x83/0x95 sd_ioctl_common+0xb6/0x150 [sd_mod] sd_ioctl+0x20/0x80 [sd_mod] blkdev_ioctl+0x1c3/0x3c0 block_ioctl+0x87/0xa0 ksys_ioctl+0x8e/0xd0 __x64_sys_ioctl+0x47/0x50 do_syscall_64+0x6f/0x310 entry_SYSCALL_64_after_hwframe+0x49/0xb3 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8932 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Overview ======== This is the SCST development repository. It contains not a single project SCST as one can think, but a number of them, which are divided as the following: 1. SCST core in scst/ subdirectory 2. Administration utility for SCST core scstadmin in scstadmin/ 3. Target drivers in own subdirectories qla2x00t/, iscsi-scst/, etc. 4. User space programs in usr/ subdirectory, like fileio_tgt. 5. Some various docs in doc/ subdirectory. Those subprojects are in most cases independent from each other, although some of them depend from the SCST core. They put in the single repository only to simplify their development, they are released independently. Thus, use "make all" only if you really need to build everything. Otherwise build only what you need, like for iSCSI-SCST: make scst scst_install iscsi iscsi_install For more information about each subproject see their README files. QLogic target driver ==================== The QLogic target driver qla2x00t is the old driver, forked from qla2xxx several years ago. It is very stable, well tested and actively used in many production setups. There is also a new driver that supports 32 Gb/s FC in the qla2x00t-32gbit directory. That driver has not yet reached the same maturity level as the old qla2x00t driver. Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net
Description
Languages
C
90.1%
Perl
4.2%
Shell
1.8%
HTML
1.7%
Makefile
1.2%
Other
0.9%