From patchwork Thu Feb 11 19:03:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 8284501 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF5B59F38B for ; Thu, 11 Feb 2016 19:03:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD5D820221 for ; Thu, 11 Feb 2016 19:03:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1614620121 for ; Thu, 11 Feb 2016 19:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750765AbcBKTDS (ORCPT ); Thu, 11 Feb 2016 14:03:18 -0500 Received: from mail-by2on0053.outbound.protection.outlook.com ([207.46.100.53]:15632 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750735AbcBKTDR (ORCPT ); Thu, 11 Feb 2016 14:03:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=493mRQ/XVb7gLmlGRhpA+25ZsKxavCQBIW3IjtEbYQQ=; b=KNInaRqz06sNaVfN23IJx13H/VPB9Np4vVpZzjJNbh76c/PN4CFU6uSacUuvyVdVaUOtRsn6xTVjm7dgJJm/7kDjmSiUnpauLq9dzziZwg6UDVLINg9Ybgnk/zfAZ7Rnim7uyurGH7L2IXmmZDZb5KhkHTfWD346VPlzQHkZSGE= Received: from BY1PR0201CA0020.namprd02.prod.outlook.com (10.160.191.158) by DM2PR02MB301.namprd02.prod.outlook.com (10.141.83.140) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 19:03:11 +0000 Received: from BN1BFFO11FD026.protection.gbl (2a01:111:f400:7c10::1:196) by BY1PR0201CA0020.outlook.office365.com (2a01:111:e400:4814::30) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Thu, 11 Feb 2016 19:03:10 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.174) smtp.mailfrom=sandisk.com; linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.174 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.174; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.174) by BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 19:03:09 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id F2.1E.03682.DEADCB65; Thu, 11 Feb 2016 11:03:09 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Thu, 11 Feb 2016 11:03:09 -0800 X-AuditID: ac160a69-d23ff70000000e62-06-56bcdaed4151 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id C2.73.03361.DEADCB65; Thu, 11 Feb 2016 11:03:09 -0800 (PST) Subject: [PATCH v4 01/21] IB/srpt: Simplify srpt_handle_tsk_mgmt() To: Doug Ledford References: <56BCDAAD.7030906@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" , "Nicholas A. Bellinger" From: Bart Van Assche Message-ID: <56BCDAED.2050701@sandisk.com> Date: Thu, 11 Feb 2016 11:03:09 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56BCDAAD.7030906@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFFi42JZI8azSPftrT1hBo+eKFtcePqdyeLl+Q+s FitXH2WyeHaol8WibfUZRosbbQ/YHNg8Fu95yeRxf/sRJo/dNxvYPJ5NP8zk8X7fVTaPz5vk AtiiuGxSUnMyy1KL9O0SuDJOvfzGXrBXruJoG18D4zTJLkZODgkBE4krX3YxdzFycQgJbGKU eHv+KJSzg1Hi8Pp2VpiqnbumsUIk5jBKbH5wiB0kISzgJDFl6QqwIhEBNYlNrxaBxYUEtCSe 9/eDNTAL3GSU2Pn3EBNIgk3ASOLb+5ksIDYvUNHTKwvBmlkEVCXWz90CViMqECFxuLOLHaJG UOLkzCdA9RwcnALaEjOvRICYzAKaEut36YNUMAvIS2x/OwfsaAmBk6wSL++vZoO4QV3i5JL5 TBMYhWchmTQLoX0WkvYFjMyrGMVyM3OKc9NTCwyN9IoT81Iyi7P1kvNzNzGC44Urcwfjiknm hxgFOBiVeHgNgHEkxJpYVlyZe4hRgoNZSYT3/iagEG9KYmVValF+fFFpTmrxIUZpDhYlcV7r FrUwIYH0xJLU7NTUgtQimCwTB6dUA2Nm3SsvvwSOrJp7W36tFlezyHvi5LfK7tjeYm12dqvL +/MPdK9oy56kV3tq9iPDA7Pi6yZGLavasVJXSv9K9O0V9vmVBuwTPjtanQoxSFqy0fnAygPp DtM6z61eaGt5U1nEkmHdmtL00CtfvS6fLvVvP9ZxNkBPye73SjbHi62r78xe7KV8UkqJpTgj 0VCLuag4EQBKT7dtkwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsXCtZEjRfftrT1hBtP38lpcePqdyeLl+Q+s FitXH2WyeHaol8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+0OG0kyM9wdTy04p814Ww== X-Forefront-Antispam-Report: CIP:63.163.107.174; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(23676002)(5008740100001)(80316001)(50986999)(11100500001)(189998001)(106466001)(65816999)(87936001)(87266999)(36756003)(86362001)(229853001)(64126003)(2950100001)(47776003)(54356999)(2906002)(76176999)(77096005)(4326007)(83506001)(19580395003)(65956001)(50466002)(19580405001)(59896002)(92566002)(1096002)(5001960100002)(65806001)(4001350100001)(230700001)(33656002)(1220700001)(586003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB301; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 2:NEywa8ivyXZQfiiEcmsUQHDHn3JFnrwVh1wNMbiGjYC2PCZ/OQp1weM8RerLCTLMxXIXxxxorhi0Pe9YivELfzeLNj1O0o2oCze1UqKaV8GY7hdmr2lEbuNAnUVMKWjkMUldMBzrBlnRC3JaKZkEmQ==; 3:gp2UJ77LuTYUnkm8RQUVRsYz2kY2jrRaPa0rJq0P5aUvrxkNVnQJbGrDrUqzo8YTJXQ8570j+wBmg2XnY58w7TnKFe3lpQ58rZhqteC9/UBZEjJA3Ct5ZxG68eRfG3znG26jX7fz4LEV0tF7AARA8A+JCW6AK0oD6tIRTwwpjIL6HMoKvsgxLpmvs4BzzMEsAKTELee1kj2GpVnkQiytM5hhznSrBgUQK9pVK6+mKu2rDUCUOvjp0ENrlfpGE9D65zl5iea/IZ20/i3QvvqVXA==; 25:X0SDm8RhF9XMaLcCPTLmndwhkQBrcALgrbPDKaAFH6mKBMidHdiZbsK6kH9oHRvbDJNzTbgriL5waOJ4gpS8pqAtfI35ZFdpPeoe6WTqwpxTwR8wx4A4w8KZLYIeTAov+7GUnh4G3Fn23YaXi6wNs/61wYwZHNPPwU8i65j/ExY0dDPDjPGPVBVAvVLdxbtPO1ChKVyPelBBKUrn/xVJUYpY4xm1sUrqIxNDvW0DmL9gfe+rUmjycOF0YIDkhMpSssATaB04lcDEBNikIwYBsY01OcW5Qm4kLg08GTYimcBSJ3yFvu4BVLTpGgDYG9XB X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:DM2PR02MB301; X-MS-Office365-Filtering-Correlation-Id: fa8840cb-1909-44cc-61ec-08d33315fc09 X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 20:fbIiCOIwQg5DnO9AkoEQyvhP8tfF6cmpNrZQ0Z7h7Tj1xqxkeUl3+FPUdUuG4Eu81niTOifY7E5OOOWql4MZChZXjOT5/mYvgcE5wRdwONZ/Kl9U/saGTyBNAvbr2EocTqlbj5nvqazIh/oybTLEXK6BVmMLSl/QB+hjAHS70qE7seSKCvtLn+nlSa35fW378B88aNcnx1E8o8Ar9BxG3StXs/hMXN1PCEoiWcFMuXdN6UxmQEvkELlFSFRNoSz36gG0XxWpu6eM/Qk7wooMTyRPmQMyVKO/VyAZ2+uY5d/r9tEmE4A2rgZCdJp+Fn/Mtk+qRurppgYY0NsGA8tNj9QuUsiuANfW/VmqWexwvfRGdXQnDTB72yajYw01sj0BmlKStje9ZTdXYELAFvoMUM3g9hXStNleWrq6qydkelQ1t6o/GX1X5VQUYWhJCmTyVk6oRx2mEfXTCp/OrrOtYqhuxRTuLKgzQsKJbJ9ZdND4md5FZg78T6KTo7hS3Vp6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13024025)(13017025)(5005006)(13023025)(13018025)(8121501046)(3002001)(10201501046); SRVR:DM2PR02MB301; BCL:0; PCL:0; RULEID:; SRVR:DM2PR02MB301; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 4:WO/gouRlcHukU5mlTcK/PmyF4vd6KXLDwnB+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NXamRPbmVRYnhxZCtUNSt4Y2pmVHNuUGJ6QTlwTjFx?= =?utf-8?B?bGZuVEtFQVNoRi80VnY4VVo4bTVQSUkwY3JxcWZxSWF4YTd3YWx2RFNvV3li?= =?utf-8?Q?T2z+OgqJRp39/+NOmsggTCr+c7?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 5:oGtWQcw5aYWyQs8mQ1NxqRMU9mw5SXUNfwja0xtwevnp8pL2EicphI8YMx4QBfqQnua9M1LABu4fmOcVZ9Yb6I19NmHIglWPjDsLfIo5YLdSkbAK9LTiGcbF/1f3b1MsF368gu9GJYXdAIsC+hYouw==; 24:gHzhmTf1kICzGzowU7UuP5zsGc9MI6Y8qgofBZIgqsb5PQuJm1GmPr0dZjJXDg6cv3LByqcMGQ5rFVCczmMn1x6h3ivuTsEeGEWdS5rntS4=; 20:3SRzou6pABXC5+bM/iCMsr5FL/Mo8WQUMK+gOgSKOmbEPHn/qEOflgaFFyvwN2IqDW2BlUZ2EFnKegSYgCJJ4B1G4CLm14CNGNau2s8GoF4obIKVEVPBZRS5oUZmkN3EJ1ZdKqLLDtVFCghqFRdB9BdU7JQ7r9qNE1fys3n1Q5sA88lqnNcPzJob+nHS4YKNWTucwGqrsQKusBaUV4W4jJj+5cC+B0aPVbg1+Y2Ce2XVsx0kTdu4fYhcmUfqRpM8 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 19:03:09.6594 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.174]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR02MB301 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let the target core check task existence instead of the SRP target driver. Additionally, let the target core check the validity of the task management request instead of the ib_srpt driver. This patch fixes the following kernel crash: BUG: unable to handle kernel NULL pointer dereference at 0000000000000001 IP: [] srpt_handle_new_iu+0x6d7/0x790 [ib_srpt] Oops: 0002 [#1] SMP Call Trace: [] srpt_process_completion+0xde/0x570 [ib_srpt] [] srpt_compl_thread+0x13f/0x160 [ib_srpt] [] kthread+0xcf/0xe0 [] ret_from_fork+0x7c/0xb0 Signed-off-by: Bart Van Assche Fixes: 3e4f574857ee ("ib_srpt: Convert TMR path to target_submit_tmr") Tested-by: Alex Estrin Reviewed-by: Christoph Hellwig Cc: Nicholas Bellinger Cc: Sagi Grimberg Cc: stable --- drivers/infiniband/ulp/srpt/ib_srpt.c | 59 +---------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0c37fee..4328679 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1670,47 +1670,6 @@ send_sense: return -1; } -/** - * srpt_rx_mgmt_fn_tag() - Process a task management function by tag. - * @ch: RDMA channel of the task management request. - * @fn: Task management function to perform. - * @req_tag: Tag of the SRP task management request. - * @mgmt_ioctx: I/O context of the task management request. - * - * Returns zero if the target core will process the task management - * request asynchronously. - * - * Note: It is assumed that the initiator serializes tag-based task management - * requests. - */ -static int srpt_rx_mgmt_fn_tag(struct srpt_send_ioctx *ioctx, u64 tag) -{ - struct srpt_device *sdev; - struct srpt_rdma_ch *ch; - struct srpt_send_ioctx *target; - int ret, i; - - ret = -EINVAL; - ch = ioctx->ch; - BUG_ON(!ch); - BUG_ON(!ch->sport); - sdev = ch->sport->sdev; - BUG_ON(!sdev); - spin_lock_irq(&sdev->spinlock); - for (i = 0; i < ch->rq_size; ++i) { - target = ch->ioctx_ring[i]; - if (target->cmd.se_lun == ioctx->cmd.se_lun && - target->cmd.tag == tag && - srpt_get_cmd_state(target) != SRPT_STATE_DONE) { - ret = 0; - /* now let the target core abort &target->cmd; */ - break; - } - } - spin_unlock_irq(&sdev->spinlock); - return ret; -} - static int srp_tmr_to_tcm(int fn) { switch (fn) { @@ -1745,7 +1704,6 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, struct se_cmd *cmd; struct se_session *sess = ch->sess; uint64_t unpacked_lun; - uint32_t tag = 0; int tcm_tmr; int rc; @@ -1761,25 +1719,10 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, srpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT); send_ioctx->cmd.tag = srp_tsk->tag; tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func); - if (tcm_tmr < 0) { - send_ioctx->cmd.se_tmr_req->response = - TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; - goto fail; - } unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun, sizeof(srp_tsk->lun)); - - if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) { - rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag); - if (rc < 0) { - send_ioctx->cmd.se_tmr_req->response = - TMR_TASK_DOES_NOT_EXIST; - goto fail; - } - tag = srp_tsk->task_tag; - } rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun, - srp_tsk, tcm_tmr, GFP_KERNEL, tag, + srp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag, TARGET_SCF_ACK_KREF); if (rc != 0) { send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;