From patchwork Mon Nov 5 18:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10668903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3769D15E9 for ; Mon, 5 Nov 2018 18:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271A2298E1 for ; Mon, 5 Nov 2018 18:40:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7762995B; Mon, 5 Nov 2018 18:40:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47E35298E1 for ; Mon, 5 Nov 2018 18:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728858AbeKFEBt (ORCPT ); Mon, 5 Nov 2018 23:01:49 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:33445 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726932AbeKFEBt (ORCPT ); Mon, 5 Nov 2018 23:01:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id :Date:Subject:Cc:To:From:reply-to:sender:bcc:in-reply-to:references: content-type; bh=/kcaeSmMBmH+8yU+3ErpIw2Ru1+BdA7r1XWzehsNpmI=; b=EQLRyxTQUJtF 5SwsiPT+Ku6ynsdI64zuFSjGEyYxuaLoOx/j0m0zZW+p87Q+FYSgdhrPFhNdPfqG1mfCpbTcWo6Y/ RCVWjFyrmDzlmidgIjLMLtB5Mk7JyU2+jVhB05N5Gu4MElGR3pIR3THfKva24CMkEPn46wd80Cmz5 gxBjfPiaIOTKt8XqMdMqsEMX6gVRaD/rr0/VLLsa2LzIuy6ZDQrv4MPdoWe//zEr5CL6g4ukRy+hG YBIDCGL46rRqakWm6oU8aUPPXD3xJEO5y0TUREwf0Wi1IrnqDVTDzokSczAe/82udKZZ+qfqKnKHm v1WG7JMeuAc8xnQ1jV9Guw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gJjnm-00080o-8m; Mon, 05 Nov 2018 19:40:43 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 4A97AC06CB; Mon, 5 Nov 2018 19:40:37 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , David Disseldorp , Mike Christie , Hannes Reinecke Subject: [PATCH] target/core: Avoid that a kernel oops can be triggered when an XCOPY command fails Date: Mon, 5 Nov 2018 10:40:11 -0800 Message-Id: <20181105184011.94041-1-bvanassche@acm.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.02) X-Recommended-Action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NEh 0yz2CFl7xGIrJ5fPg33HFhWuygEwwwWe3xXNBQ8NJdm4Pscvb9y1CBweR1aEOEmF+7+XwJhp74Ne BZS/7a9ATcUMpAEntM8yKElR+Y84QVlpY/2Olap60rnP5huMjJeWSwzfzlDTegaelgiu9QvTToG3 X/ekOoQKVaL7/+VCcmuF/Q== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes: aa73237dcb2d ("scsi: target/core: Always call transport_complete_callback() upon failure") Cc: Nicholas Bellinger Cc: David Disseldorp Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche Reviewed-by: David Disseldorp --- drivers/target/target_core_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index e31e4fc31aa1..2cfd61d62e97 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;