diff options
-rw-r--r-- | drivers/target/target_core_sbc.c | 7 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 5c822fdc8f6f..2cd9acdeb543 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -372,6 +372,13 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd) | |||
372 | sense_reason_t ret = TCM_NO_SENSE; | 372 | sense_reason_t ret = TCM_NO_SENSE; |
373 | int rc, i; | 373 | int rc, i; |
374 | 374 | ||
375 | /* | ||
376 | * Handle early failure in transport_generic_request_failure(), | ||
377 | * which will not have taken ->caw_mutex yet.. | ||
378 | */ | ||
379 | if (!cmd->t_data_sg || !cmd->t_bidi_data_sg) | ||
380 | return TCM_NO_SENSE; | ||
381 | |||
375 | buf = kzalloc(cmd->data_length, GFP_KERNEL); | 382 | buf = kzalloc(cmd->data_length, GFP_KERNEL); |
376 | if (!buf) { | 383 | if (!buf) { |
377 | pr_err("Unable to allocate compare_and_write buf\n"); | 384 | pr_err("Unable to allocate compare_and_write buf\n"); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index e53c59ba745a..bcbc3d397bad 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1559,6 +1559,13 @@ void transport_generic_request_failure(struct se_cmd *cmd, | |||
1559 | * For SAM Task Attribute emulation for failed struct se_cmd | 1559 | * For SAM Task Attribute emulation for failed struct se_cmd |
1560 | */ | 1560 | */ |
1561 | transport_complete_task_attr(cmd); | 1561 | transport_complete_task_attr(cmd); |
1562 | /* | ||
1563 | * Handle special case for COMPARE_AND_WRITE failure, where the | ||
1564 | * callback is expected to drop the per device ->caw_mutex. | ||
1565 | */ | ||
1566 | if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && | ||
1567 | cmd->transport_complete_callback) | ||
1568 | cmd->transport_complete_callback(cmd); | ||
1562 | 1569 | ||
1563 | switch (sense_reason) { | 1570 | switch (sense_reason) { |
1564 | case TCM_NON_EXISTENT_LUN: | 1571 | case TCM_NON_EXISTENT_LUN: |