aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-05-19 18:10:44 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-19 18:18:20 -0400
commitee7619f2eb21304dcc846b8dc8f8c3d6cbe11792 (patch)
tree4aad4ca471d2d69afac62087a716c4aa83d71ce8
parent6c2faeaa0ecc67098106771cba8b7ed1e99a1b5f (diff)
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: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/iscsi/iscsi_target.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.c5
-rw-r--r--drivers/target/target_core_sbc.c2
3 files changed, 3 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 34871a628b11..74e6114ff18f 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg)
230 * Here we serialize access across the TIQN+TPG Tuple. 230 * Here we serialize access across the TIQN+TPG Tuple.
231 */ 231 */
232 ret = down_interruptible(&tpg->np_login_sem); 232 ret = down_interruptible(&tpg->np_login_sem);
233 if ((ret != 0) || signal_pending(current)) 233 if (ret != 0)
234 return -1; 234 return -1;
235 235
236 spin_lock_bh(&tpg->tpg_state_lock); 236 spin_lock_bh(&tpg->tpg_state_lock);
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index e8a240818353..5e3295fe404d 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -161,10 +161,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np(
161int iscsit_get_tpg( 161int iscsit_get_tpg(
162 struct iscsi_portal_group *tpg) 162 struct iscsi_portal_group *tpg)
163{ 163{
164 int ret; 164 return mutex_lock_interruptible(&tpg->tpg_access_lock);
165
166 ret = mutex_lock_interruptible(&tpg->tpg_access_lock);
167 return ((ret != 0) || signal_pending(current)) ? -1 : 0;
168} 165}
169 166
170void iscsit_put_tpg(struct iscsi_portal_group *tpg) 167void iscsit_put_tpg(struct iscsi_portal_group *tpg)
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 8855781ac653..733824e3825f 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -568,7 +568,7 @@ sbc_compare_and_write(struct se_cmd *cmd)
568 * comparision using SGLs at cmd->t_bidi_data_sg.. 568 * comparision using SGLs at cmd->t_bidi_data_sg..
569 */ 569 */
570 rc = down_interruptible(&dev->caw_sem); 570 rc = down_interruptible(&dev->caw_sem);
571 if ((rc != 0) || signal_pending(current)) { 571 if (rc != 0) {
572 cmd->transport_complete_callback = NULL; 572 cmd->transport_complete_callback = NULL;
573 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 573 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
574 } 574 }