Commit ee7619f2 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target: Drop signal_pending checks after interruptible lock acquire

Once upon a time, iscsit_get_tpg() was using an un-interruptible
lock.  The signal_pending() usage was a check to allow userspace
to break out of the operation with SIGINT.

AFAICT, there's no reason why this is necessary anymore, and as
reported by Alexey can be potentially dangerous.  Also, go ahead
and drop the other two problematic cases within iscsit_access_np()
and sbc_compare_and_write() as well.

Found by Linux Driver Verification project (linuxtesting.org).
Reported-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 6c2faeaa
...@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg) ...@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg)
* Here we serialize access across the TIQN+TPG Tuple. * Here we serialize access across the TIQN+TPG Tuple.
*/ */
ret = down_interruptible(&tpg->np_login_sem); ret = down_interruptible(&tpg->np_login_sem);
if ((ret != 0) || signal_pending(current)) if (ret != 0)
return -1; return -1;
spin_lock_bh(&tpg->tpg_state_lock); spin_lock_bh(&tpg->tpg_state_lock);
......
...@@ -161,10 +161,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np( ...@@ -161,10 +161,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np(
int iscsit_get_tpg( int iscsit_get_tpg(
struct iscsi_portal_group *tpg) struct iscsi_portal_group *tpg)
{ {
int ret; return mutex_lock_interruptible(&tpg->tpg_access_lock);
ret = mutex_lock_interruptible(&tpg->tpg_access_lock);
return ((ret != 0) || signal_pending(current)) ? -1 : 0;
} }
void iscsit_put_tpg(struct iscsi_portal_group *tpg) void iscsit_put_tpg(struct iscsi_portal_group *tpg)
......
...@@ -568,7 +568,7 @@ sbc_compare_and_write(struct se_cmd *cmd) ...@@ -568,7 +568,7 @@ sbc_compare_and_write(struct se_cmd *cmd)
* comparision using SGLs at cmd->t_bidi_data_sg.. * comparision using SGLs at cmd->t_bidi_data_sg..
*/ */
rc = down_interruptible(&dev->caw_sem); rc = down_interruptible(&dev->caw_sem);
if ((rc != 0) || signal_pending(current)) { if (rc != 0) {
cmd->transport_complete_callback = NULL; cmd->transport_complete_callback = NULL;
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment