diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8f29f472c50b..0bdb6badbf99 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -3411,6 +3411,18 @@ int transport_generic_map_mem_to_cmd( | |||
3411 | 3411 | ||
3412 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || | 3412 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || |
3413 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { | 3413 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { |
3414 | /* | ||
3415 | * Reject SCSI data overflow with map_mem_to_cmd() as incoming | ||
3416 | * scatterlists already have been set to follow what the fabric | ||
3417 | * passes for the original expected data transfer length. | ||
3418 | */ | ||
3419 | if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { | ||
3420 | pr_warn("Rejecting SCSI DATA overflow for fabric using" | ||
3421 | " SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC\n"); | ||
3422 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
3423 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
3424 | return -EINVAL; | ||
3425 | } | ||
3414 | 3426 | ||
3415 | cmd->t_data_sg = sgl; | 3427 | cmd->t_data_sg = sgl; |
3416 | cmd->t_data_nents = sgl_count; | 3428 | cmd->t_data_nents = sgl_count; |