diff options
author | Jiang Yi <jiangyilism@gmail.com> | 2017-05-16 09:57:55 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-07 10:07:47 (GMT) |
commit | 49d33fd10070902fa1cd4a0c5bfb4b41c072af5d (patch) | |
tree | 72785f10bd7ca317220cba6472126b9f5e367c58 /drivers/target/target_core_ua.h | |
parent | ecbf0f48d65ecd1eecfe6c81af8b9c2589ab5641 (diff) | |
download | linux-49d33fd10070902fa1cd4a0c5bfb4b41c072af5d.tar.xz |
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>
Diffstat (limited to 'drivers/target/target_core_ua.h')
0 files changed, 0 insertions, 0 deletions