]> git.baikalelectronics.ru Git - kernel.git/commit
iscsi-target: Fix incorrect np->np_thread NULL assignment
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 11 Dec 2013 23:45:32 +0000 (15:45 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 19 Dec 2013 08:18:25 +0000 (00:18 -0800)
commitc9c48463d0aeb0e6f106dac5312933327797fa38
tree7491659574ec90fa70a41fa3401aadc8ab55e3cb
parent667e4f9ab2312f306b31065967e347d0bc2fb5ea
iscsi-target: Fix incorrect np->np_thread NULL assignment

When shutting down a target there is a race condition between
iscsit_del_np() and __iscsi_target_login_thread().
The latter sets the thread pointer to NULL, and the former
tries to issue kthread_stop() on that pointer without any
synchronization.

This patch moves the np->np_thread NULL assignment into
iscsit_del_np(), after kthread_stop() has completed. It also
removes the signal_pending() + np_state check, and only
exits when kthread_should_stop() is true.

Reported-by: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org> #3.12+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target_login.c