Skip to content

Commit ed97d0c

Browse files
Andy GroverNicholas Bellinger
authored andcommitted
target/user: Fix UFLAG_UNKNOWN_OP handling
Calling transport_generic_request_failure() from here causes list corruption. We should be using target_complete_cmd() instead. Which we do in all other cases, so the UNKNOWN_OP case can become just another member of the big else/if chain in tcmu_handle_completion(). Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 06b967e commit ed97d0c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/target/target_core_user.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -538,14 +538,8 @@ static void tcmu_handle_completion(struct tcmu_cmd *cmd, struct tcmu_cmd_entry *
538538
UPDATE_HEAD(udev->data_tail, cmd->data_length, udev->data_size);
539539
pr_warn("TCMU: Userspace set UNKNOWN_OP flag on se_cmd %p\n",
540540
cmd->se_cmd);
541-
transport_generic_request_failure(cmd->se_cmd,
542-
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE);
543-
cmd->se_cmd = NULL;
544-
kmem_cache_free(tcmu_cmd_cache, cmd);
545-
return;
546-
}
547-
548-
if (entry->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
541+
entry->rsp.scsi_status = SAM_STAT_CHECK_CONDITION;
542+
} else if (entry->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
549543
memcpy(se_cmd->sense_buffer, entry->rsp.sense_buffer,
550544
se_cmd->scsi_sense_length);
551545

0 commit comments

Comments
 (0)