From: Bart Van Assche Date: Tue, 6 Nov 2018 00:44:59 +0000 (-0800) Subject: scsi: target/core: Avoid that a kernel oops is triggered when COMPARE AND WRITE fails X-Git-Tag: v5.15~7392^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5841734fa6f997e57e8c29cbb6409bd74a6949e8;p=platform%2Fkernel%2Flinux-starfive.git scsi: target/core: Avoid that a kernel oops is triggered when COMPARE AND WRITE fails Fixes: aa73237dcb2d ("scsi: target/core: Always call transport_complete_callback() upon failure") Reviewed-by: David Disseldorp Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index e31e4fc..2cfd61d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1778,7 +1778,7 @@ EXPORT_SYMBOL(target_submit_tmr); void transport_generic_request_failure(struct se_cmd *cmd, sense_reason_t sense_reason) { - int ret = 0; + int ret = 0, post_ret; pr_debug("-----[ Storage Engine Exception; sense_reason %d\n", sense_reason); @@ -1790,7 +1790,7 @@ void transport_generic_request_failure(struct se_cmd *cmd, transport_complete_task_attr(cmd); if (cmd->transport_complete_callback) - cmd->transport_complete_callback(cmd, false, NULL); + cmd->transport_complete_callback(cmd, false, &post_ret); if (transport_check_aborted_status(cmd, 1)) return;