mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
c2f9ce8df820aa58d4318aa90405132d9fc69329
Decrementing the tgt_dev_cmd_count ref happens in
scst_pre_xmit_response1(). This may lead to a race condition between
scst_acg_repl_lun() and scst_tgt_cmd_done()'s cmd processing, which
may lead to a general protection fault.
cmd processing replace LUN
-------------- -----------
[1] atomic_dec(tgt_dev->tgt_dev_cmd_count)
[2] scst_wait_for_tgt_devs()
[3] scst_free_tgt_dev()
[4] scst_tgt_dev_stop_threads()
[5] scst_tgt_cmd_done(cmd, SCST_CONTEXT_THREAD)
[6] scst_process_redirect_cmd()
[7] if (cmd->cmd_thr != NULL) {
[8] active_cmd_list = &cmd->cmd_thr->thr_active_cmd_list;
cmd->cmd_thr is already dead pointer here,
because it is pointing on thread which was freed
in scst_tgt_dev_stop_threads().
[9] list_add(&cmd->cmd_list_entry, active_cmd_list);
general protection fault: 0000
RIP: 0010:__list_add_valid+0x1/0x74
Call Trace:
scst_tgt_cmd_done+0x12b/0x160 [scst]
...
Hence, to avoid this race condition, move the decrement of
tgt_dev_cmd_count from the SCST_CMD_STATE_PRE_XMIT_RESP1 to
the SCST_CMD_STATE_FINISHED state, which is assigned after
scst_tgt_cmd_done() was called.
Overview
This is the source code repository of the SCST project. SCST is a collection of Linux kernel drivers that implement SCSI target functionality. The SCST project includes:
- The SCST core in the scst/ subdirectory.
- A tool for loading, saving and modifying the SCST configuration in directory scstadmin/.
- Several SCSI target drivers in the directories iscsi-scst/, qla2x00t/, srpt/, scst_local/ and fcst/.
- User space programs in the usr/ subdirectory, e.g. fileio_tgt.
- Various documentation in the doc/ subdirectory.
Instructions for building and installing SCST are available in the INSTALL.md file.
QLogic target driver
Two QLogic target drivers are included in the SCST project.
The default driver is located in qla2x00t-32gbit directory and it supports up to 32 Gb/s FC. It is the newer one.
May anyone wish to switch back to the older driver that only supported up to
16 Gb/s adapters, it is located in qla2x00t directory. To make use of the
older driver build scst with environment variable QLA_32GBIT=no set.
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%