From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5E12C2D0A3 for ; Tue, 27 Oct 2020 00:30:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B527216FD for ; Tue, 27 Oct 2020 00:30:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bKME0gnI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AucSO+U5"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="2wjJWXAF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B527216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/gIjAucEmk7lvt42vaPdrpWKVvOE0TOClv3GuwIyG+Y=; b=bKME0gnIPh7fggF6WYevFl4YV GWlt0b/skjQc5MOmPYf8f4pdgBtpozQ/OTuJWBIhS7JRdjLncQAjSQH594sxNc8EsEqCKMPcrc+uK m12N+HRGQeLzs8PDfNPSUWsoS/xZRYgHC/bv7NZbKeZu5kaJThTK7LA+Hkkeh8V27CgWrrXpa8KU3 IL0RZsx0v3O7c834OFwotT8KVyyE79dp4X3+BzDLpP7ur+/3oqpclTTvfI6B72lSlDuD69VaemsDl scgU5Iuf1xp4C+JrURk9y24uzg3YgDUFDicOvAX892V5QDFx9OqT6X6LD9WKgVFETIAm6Fu/Ur/aG W0mZDxY1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXCsy-0002ve-T2; Tue, 27 Oct 2020 00:30:49 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXCo4-0000RP-1p for linux-nvme@merlin.infradead.org; Tue, 27 Oct 2020 00:25:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Ic3NvpCbyUB9f0ZgYzvp5lClCiFnF/FvUGoAVguJo1M=; b=AucSO+U5r/kKIyqXe4ep6zQ7XQ 2elEc4ZwLCYsrLuOXnl3TcimwYwDKuyi+TbJHZvC0DNGYn7XplxHoqCVEpnsGVq8cKISQ/hUxy03I pRMkjEnH74uW6tIk9rxmGUc80vtAWrP+1rKcWh+Hjbs1Emvhzh7WowlKuq5h7DpXKjWGOUIrU9Wdv U1vjdoT09Go0RbIaHl+o4a2UNe1XVen7t1EjdPdZAhBRePfsJOaCY5t8bULQIc4kphDweBbBUdTyA tCLrpDTlPCzxJF+I5JtxFczfxwQRLLY9SyMRA3IP7CwfaIlN/mnlPWNVO/O4BUFbyAVuYw1o8U7l0 C+7UuN0A==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXCZX-00004s-Aq for linux-nvme@lists.infradead.org; Tue, 27 Oct 2020 00:10:48 +0000 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEE6C216FD; Tue, 27 Oct 2020 00:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603757441; bh=i7JPtbEiXAS705p4PMda+eMSdKJ4qDNXLXWfIebaYWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2wjJWXAFTcoSEiYgnF4rjBFJqN3uB79+/6bdHQ+eBpxTaU6Svuhg3XBhpNikL8ETr 4vXvyj4KMFXu8Z9nhyVGKPeItiLPt3TUhHC+xyGfmz5tG1pjJDAas++PzMDI9/JXG3 E5fYOWHwSRE2nmJ+4cOq58tb4nVaFVIEccDujPCg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 46/46] nvme-rdma: fix crash when connect rejected Date: Mon, 26 Oct 2020 20:09:45 -0400 Message-Id: <20201027000946.1026923-46-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201027000946.1026923-1-sashal@kernel.org> References: <20201027000946.1026923-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201027_001044_492911_4FB370F9 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , linux-nvme@lists.infradead.org, Sagi Grimberg , Chao Leng , Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Chao Leng [ Upstream commit 43efdb8e870ee0f58633fd579aa5b5185bf5d39e ] A crash can happened when a connect is rejected. The host establishes the connection after received ConnectReply, and then continues to send the fabrics Connect command. If the controller does not receive the ReadyToUse capsule, host may receive a ConnectReject reply. Call nvme_rdma_destroy_queue_ib after the host received the RDMA_CM_EVENT_REJECTED event. Then when the fabrics Connect command times out, nvme_rdma_timeout calls nvme_rdma_complete_rq to fail the request. A crash happenes due to use after free in nvme_rdma_complete_rq. nvme_rdma_destroy_queue_ib is redundant when handling the RDMA_CM_EVENT_REJECTED event as nvme_rdma_destroy_queue_ib is already called in connection failure handler. Signed-off-by: Chao Leng Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index c91bfd839cabe..564e457f1345e 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1545,7 +1545,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, complete(&queue->cm_done); return 0; case RDMA_CM_EVENT_REJECTED: - nvme_rdma_destroy_queue_ib(queue); cm_error = nvme_rdma_conn_rejected(queue, ev); break; case RDMA_CM_EVENT_ROUTE_ERROR: -- 2.25.1 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme