android_kernel_oneplus_msm8998/drivers/target
Jiang Yi 119903dc36 iscsi-target: Always wait for kthread_should_stop() before kthread exit
commit 5e0cf5e6c43b9e19fc0284f69e5cd2b4a47523b0 upstream.

There are three timing problems in the kthread usages of iscsi_target_mod:

 - np_thread of struct iscsi_np
 - rx_thread and tx_thread of struct iscsi_conn

In iscsit_close_connection(), it calls

 send_sig(SIGINT, conn->tx_thread, 1);
 kthread_stop(conn->tx_thread);

In conn->tx_thread, which is iscsi_target_tx_thread(), when it receive
SIGINT the kthread will exit without checking the return value of
kthread_should_stop().

So if iscsi_target_tx_thread() exit right between send_sig(SIGINT...)
and kthread_stop(...), the kthread_stop() will try to stop an already
stopped kthread.

This is invalid according to the documentation of kthread_stop().

(Fix -ECONNRESET logout handling in iscsi_target_tx_thread and
 early iscsi_target_rx_thread failure case - nab)

Signed-off-by: Jiang Yi <jiangyilism@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-11 09:08:49 -07:00
..
iscsi iscsi-target: Always wait for kthread_should_stop() before kthread exit 2017-08-11 09:08:49 -07:00
loopback
sbp
tcm_fc
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c
target_core_device.c target: Fix NULL dereference during LUN lookup + active I/O shutdown 2017-03-15 09:57:14 +08:00
target_core_fabric_configfs.c target: Avoid mappedlun symlink creation during lun shutdown 2017-08-11 09:08:49 -07:00
target_core_fabric_lib.c
target_core_file.c target/fileio: Fix zero-length READ and WRITE handling 2017-05-20 14:26:58 +02:00
target_core_file.h
target_core_hba.c
target_core_iblock.c target: Fix max_unmap_lba_count calc overflow 2016-08-20 18:09:26 +02:00
target_core_iblock.h
target_core_internal.h target: Fix kref->refcount underflow in transport_cmd_finish_abort 2017-06-29 12:48:51 +02:00
target_core_pr.c
target_core_pr.h
target_core_pscsi.c target/pscsi: Fix TYPE_TAPE + TYPE_MEDIMUM_CHANGER export 2017-03-26 12:13:19 +02:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c target: Fix compare_and_write_callback handling for non GOOD status 2017-05-20 14:26:58 +02:00
target_core_spc.c
target_core_stat.c target/stat: print full t10_wwn.model buffer 2015-11-28 21:23:13 -08:00
target_core_tmr.c target: Fix kref->refcount underflow in transport_cmd_finish_abort 2017-06-29 12:48:51 +02:00
target_core_tpg.c target: Avoid mappedlun symlink creation during lun shutdown 2017-08-11 09:08:49 -07:00
target_core_transport.c target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce 2017-07-27 15:06:09 -07:00
target_core_ua.c
target_core_ua.h
target_core_user.c target/user: Fix use-after-free of tcmu_cmds if they are expired 2017-01-09 08:07:53 +01:00
target_core_xcopy.c target: Use correct SCSI status during EXTENDED_COPY exception 2017-02-14 15:22:51 -08:00
target_core_xcopy.h