From patchwork Tue Jan 5 14:27:45 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: 7955431 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C78FBBEEE5 for ; Tue, 5 Jan 2016 14:27:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF6702037F for ; Tue, 5 Jan 2016 14:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFE192037E for ; Tue, 5 Jan 2016 14:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751921AbcAEO1y (ORCPT ); Tue, 5 Jan 2016 09:27:54 -0500 Received: from mail-bl2on0098.outbound.protection.outlook.com ([65.55.169.98]:38883 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751866AbcAEO1u (ORCPT ); Tue, 5 Jan 2016 09:27:50 -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=ohYmn4wRKb1OI+EC8uC5n3qajZucOJq/xgaPlpWCvpo=; b=b/z4W1o90OjUjT9hBqbqe2jsrH7oqsNPOYwRmILIhKwVj5ALb98WzRl5kYExXe5sp4AFUzNwC3IINmWslFmCevFn+Zf7PgEKrETCffSs54LGtcdE/irBlcO4Fas0VAi39fKOoOEYK/Z+vZliq8Pqe8+VSFo8FnCqqT3yd9wbn5Y= Received: from BY2PR02CA0097.namprd02.prod.outlook.com (10.163.44.151) by BL2PR02MB289.namprd02.prod.outlook.com (10.141.90.143) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:27:48 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::182) by BY2PR02CA0097.outlook.office365.com (2a01:111:e400:5261::23) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:27:48 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:27:47 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id F9.B9.20094.3E2DB865; Tue, 5 Jan 2016 06:27:47 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.248.2; Tue, 5 Jan 2016 06:27:47 -0800 X-AuditID: ac160a68-f79196d000004e7e-3d-568bd2e383e7 Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id E3.0E.08831.2E2DB865; Tue, 5 Jan 2016 06:27:47 -0800 (PST) Subject: [PATCH 15/15] IB/srpt: Fix a rare crash in srpt_close_session() To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD2E1.1060701@sandisk.com> Date: Tue, 5 Jan 2016 15:27:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <568BD0FC.70207@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsWyRoxnke7jS91hBsc3SFm8PP+B1WLl6qNM Fs8O9bI4MHvsvtnA5vF+31U2j8+b5AKYo7hsUlJzMstSi/TtErgyNq68z1Jwgb1i4exXzA2M m9m6GDk5JARMJJ4/aWWEsMUkLtxbDxTn4hASOMEocf3LXGYIZzujxIO2lywwHWsOHADrEBLY zCjx9L00iC0s4CHxaW8zWFxEQE1i06tF7F2MHEA1GhLvtmaBhJkF4iXWfXoDVsImYCTx7f1M sJG8AloSzya0s4PYLAIqEr//fmYGsUUFIiR+bFjCCFEjKHFy5hOwek4BTYn/rbvAxjMD2et3 6UOMl5fY/nYOM8SVy1glVu8yhrhSXeLkkvlMExhFZiGZNAuhexaS7gWMzKsYxXIzc4pz01ML DA31ihPzUjKLs/WS83M3MYLjgCtjB+PWSeaHGAU4GJV4eDledoUJsSaWFVfmHmKU4GBWEuF9 faQ7TIg3JbGyKrUoP76oNCe1+BCjNAeLkjivdYtamJBAemJJanZqakFqEUyWiYNTqoHRJYi3 Z53h3xnNLD1LtAQ2VM15O0Nmd9fj3PthEu87DrsVWUwIZCv9+v28sP3RiKdmXq1sNf+uTeX1 rNCM37A94rH2H6P/RaeXL/o44Y7C/+9pNvzFcQ93nr7758P0hkM77JzXyUjmZr37yuIiM6nA aKdBdveWNb/snrj4BTVwHjruU+O95dUDJZbijERDLeai4kQA71UtZH8CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsXCtZEjRffxpe4wgxVfuCxenv/AarFy9VEm i2eHelkcmD1232xg83i/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZG1feZym4wF6xcPYr5gbG zWxdjJwcEgImEmsOHGCEsMUkLtxbDxTn4hAS2MgoMWvDdLCEsICHxKe9zWC2iICaxKZXi9i7 GDmAijQk3m3NAjGZBeIl7nYygVSwCRhJfHs/kwXE5hXQkng2oZ0dxGYRUJH4/fczM4gtKhAh 8WPDEkaIGkGJkzOfgNVzCmhK/G/dBVbPLKAu8WfeJWYIW15i+9s5zBMY+WchaZmFpGwWkrIF jMyrGMVyM3OKc9MzCwwN9YoT81Iyi7P1kvNzNzGCw5Ezcgfj04nmhxiZODilGhhLspkbH+TO bYhw2Mz7e9G3Tzcu3dj/4FJsplHhp0KH/g0Si/f2be3ee2biosorVwLef7xyWGna0ucpHIum C9xNYXLd9ffhw0sJ6yPqYrPq23OcUlpWRm/P/yHsferDgU1Lt7x4zCGtqdX7w0jGi+2fpBaj ddF+22vBzbXz7l7NXcTz8aBQZna7EktxRqKhFnNRcSIA3IgMZ/cBAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD048; 1:UsX7iMSJYx1teO9/7eF+q6gMpFHcZL+OZozzuG1kzaxO5XAXXi2cXSaDEbcHYoAfdeVO6oYuoahXVCG/+cuhWwC07T4OJ2ub4ft9XrVUpLbPQWweG5HfqPbTCsT/75qsk6I+kID9a11lL+aH64EOT3Vw3Sd9nEjR60ZQQ+zH+J6hT26IA2Tt1+nedwapyjkFj4XpMWsbVR+4xiY5EZOh2GWCXZWhCcSn1aWH5otlwFlE0QBP47flr3PosDgFf7rVJgpVm8AvcfEuYxgC7GGmIJGKi8Tdva3pz4V4SbQOjhNZ64KoYI1Ld/OIB8pSNEl1Or6JaEzawnIyjo0p/OvPoqDo3JFiWmTEbzYnIj7G3UaJIWJYZF0/pyjrNAHIiwYo X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(110136002)(69596002)(33656002)(19580395003)(81156007)(106466001)(5001960100002)(80316001)(19580405001)(50986999)(65816999)(65806001)(189998001)(54356999)(97736004)(65956001)(87266999)(2950100001)(50466002)(83506001)(64126003)(229853001)(87936001)(86362001)(59896002)(4001350100001)(1096002)(230700001)(76176999)(5008740100001)(1220700001)(47776003)(11100500001)(23676002)(586003)(36756003)(4326007)(77096005)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB289; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB289; 2:llnY3+hFEQj1JzOYoUQR26mbGAVgrWICiZOopOLs754oorQmMI9BzwdGeimqi8XFifeRA5xCAYuvBx4Pp7DABGim9cMXs1iOJHFYqE5JyrXVwIClVVfEFx+BUtkUVaZwddnLQVnbMk/ZRKJMe0Kmiw==; 3:m8Ewh/ZZWNvcaqtsoM3wpWC3HChve/B3vYuykAaKyziy52xN4ENiAseToEMUovLv0QltC5+owKQlapmic2T+eSHp3UuC+PVXqIsVDv1c54ft5QWEUTPdz6dXpYzloFXjY0kVOBQU4Od24WLdrBReQgV8u2zMlQ7HsfALzYtpPf7iti5RPZAOl0S2xcGt3XqeHJ1ENivzgD2D/BUBchMAwM0BuWIUH0xT9OPxNZxiVtTG0v69E/EQHLgKueYhW6ddmkXTnmXDshMUekeEnULLrA==; 25:uwqj+eXVYQlYA6az7py20dtBi9ceYua6WViWHODYQRJYXMGe57qXXOxoOpiYrhmrKW0zeios0ezkbHNQnJK89HL0zEk9TH7z3o+Tz265pKPZajh2mCEsmlXiV+sBln6lS7/hvg632MAnvH8nO5SIwgFRdcT1ZWEZedl4A8rRRkSNBQie9AcTh/nAhSutAYYaAk10rx3TVa2LUHFId4fjrbhs396dx4yh/6ehZeFd7ceEMsNE05593wnEpUm+Q5oj X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB289; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB289; 20:2lp4EwUBRM7aEUoU+LsLZoHXRb+RqReCWZhLkKt/SWhBpgKFdeU6KKw4tF9GZl90jxQWBw5opt47rIbootJJLYLtHHeFUyc/Z1Tz8X13R46qLwym1hWVJ5oNYk8WGBi8wTrTU9YPt/+IeVDoveqjM2sJpSUSEYrOVsk3ucGMHHT3tlpQwlvFjwSNFrH4p6/RHjWs3VmXIUmGrFVj2+HpMQ8AbeRC5pTrllw7xKDWF3zzt9xdycFxTRCwKJEdtcQ3WJH4LLQVbVkwsYOMIbDptVmUgXYsZrdPvbNRGbDZVQb7U70Hp324TnlW5ZP/nqVvXB4xanSd5+NfbTMWGoMI0/2rhsaxB7wmPXWucExYxK3Yrryqt6onlkppKzM/cmKi+rSyFZcxlX/BR6zYxa0QWxA8SbpHDuaU+xk5ewmJBopqlwB4W5LhsEWv12xY75W07K2RoZXHMJl6Ch3dcmfyp334yOG6oLLBqB8G7+EOa/I0fGfHgqfY4N+AfXfIHY09; 4:gSkD+bvrSjdaVyHv7tCl8/naVlcsQWx7SKqJrnt1LcLuSUJLf6L4jx1DD7a8tPDWK9QuFULUEQMDfn8P6HjWlI1aR20VJSqxRoB6/9FZ22pL6lEniQzk7mgsLwejtJkwHk4NeaEi3kewcivr+aVYlIcsOIW8i2GrjhNmQhbkW1YFNvQU4i8gXefXhdaNXvebpqRaAeBqFzC18TZMoz60zoGyRVEKIOi4JDGVRhPGcvRR2ECvil9VDhSHBle3PqW5gUzgx6iAI6c7L7BMeWNAEGlmkW9hzPyN6GgGrqFrRhnq2FJtQFGjAc9lyYaZ236NjMRI3d0o3/gmOkSJqyaG7Y+qFIjTe7RUNCUGjRDH9MmoA2K9a+lCCQ4WBHvl2mSNZocAfc4ZzAiIaiDPblZI3bnnHXq5S1RC5hMMBhM 5h2w= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); S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2JQKMsjOU+2EL/cXKY5Z3+irNkj7F3xDCH3EBKj5E953iM/CNC3u+S7oVSmXW+WZH+0CTL2Nm+FKiHs2hXcM2OxwKR86dwY93tq8PjlTkww=; 20:xJw8NjckK1KSEu4fwPGPk3grm3qzqAhk6w4Vfs4sOTDwJe4++LrBxKs5uV8W23MehnObK3e/0ZNsFYXIPSJJtzE3QzmOWqccXAJD0dZQvS6WQFAKRrmPRtovDPQd0RUxbfOWu5iaue+p+9P3QBG97a5B1lQjL0P2a53VXLWA/RFlc9uK7cTZdtkGqLeW11vgBX9wnl36F4D0tDHaggFFe+N/LQYkmAy82vmz59Xb7TIpzEwM344tIq/ET6H1fdzo SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:27:47.6593 (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.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR02MB289 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 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 Keep the ib_srpt session as long as srpt_close_session() may access it. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 669ae5c..7548bd5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2228,6 +2228,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, pr_debug("Establish connection sess=%p name=%s cm_id=%p\n", ch->sess, ch->sess_name, ch->cm_id); + kref_get(&ch->kref); + /* create srp_login_response */ rsp->opcode = SRP_LOGIN_RSP; rsp->tag = req->tag; @@ -2991,6 +2993,8 @@ static void srpt_close_session(struct se_session *se_sess) srpt_disconnect_ch(ch); + kref_put(&ch->kref, srpt_free_ch); + if (!wait) return;