aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index ba698ea62bb2..f5516a1a32e8 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -65,6 +65,12 @@ int transport_get_lun_for_cmd(
65 unsigned long flags; 65 unsigned long flags;
66 int read_only = 0; 66 int read_only = 0;
67 67
68 if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) {
69 se_cmd->scsi_sense_reason = TCM_NON_EXISTENT_LUN;
70 se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
71 return -1;
72 }
73
68 spin_lock_irq(&SE_NODE_ACL(se_sess)->device_list_lock); 74 spin_lock_irq(&SE_NODE_ACL(se_sess)->device_list_lock);
69 deve = se_cmd->se_deve = 75 deve = se_cmd->se_deve =
70 &SE_NODE_ACL(se_sess)->device_list[unpacked_lun]; 76 &SE_NODE_ACL(se_sess)->device_list[unpacked_lun];
@@ -187,6 +193,12 @@ int transport_get_lun_for_tmr(
187 struct se_session *se_sess = SE_SESS(se_cmd); 193 struct se_session *se_sess = SE_SESS(se_cmd);
188 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; 194 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
189 195
196 if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) {
197 se_cmd->scsi_sense_reason = TCM_NON_EXISTENT_LUN;
198 se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
199 return -1;
200 }
201
190 spin_lock_irq(&SE_NODE_ACL(se_sess)->device_list_lock); 202 spin_lock_irq(&SE_NODE_ACL(se_sess)->device_list_lock);
191 deve = se_cmd->se_deve = 203 deve = se_cmd->se_deve =
192 &SE_NODE_ACL(se_sess)->device_list[unpacked_lun]; 204 &SE_NODE_ACL(se_sess)->device_list[unpacked_lun];