Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp268399pxx; Wed, 28 Oct 2020 04:34:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuUbKHNSi7KJFfZlE26jmofL1Ca4rB028a6WMx7rjsleOtIF+feP2uer6Lm7CVKIWlpwva X-Received: by 2002:a05:6402:2d7:: with SMTP id b23mr1605735edx.196.1603884888745; Wed, 28 Oct 2020 04:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884888; cv=none; d=google.com; s=arc-20160816; b=yEcZfO/WSsyHxVdQ+iWOJkvezkQ0qzuoEphgYuoManwlc4HKZ7woIRPX6+FgvcWIXj xZjmmPhoESEKFPBqOs0r5Ls4yXikVgSVGKVe26Qgq7jrNpmBafP4a9NYclh67n9B3fKS aaSboqDRLygOS8BmUc4lt06SnXPMFjGkqIL0BnHhZM0TkOpFjRgPV8W92DMxxz/Q+oVG g30yzJJHECVLWO0wlE/N4frDw7yHckiBpkMG7F+mPDf1V/68Up3iA2xm1dq1Q49VpqSo lFNP+SJgxy1XDjy+RQjc9M4Xo4htaUKpw0Q/nPK6e6crbPmL3EMJHinc9yZ9wlBHanI0 rjJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GKaiY+20Yi4OhyrNwCISA7Km1vgiOi/jDXLDcDk1Qyc=; b=ira0sffJmVsJKzBdHZ6qcnFRo7uOhOw225zvIRz1tfIokZj4AciGzNy0mZ8gIJGtdY L9q2aKJhiS7RqVTtiBdjN/BVSgEYtsvClfsSBabyZzVF8IC77wRq3pV2WusUcIOnWToc n/tfEWVnZ9qh+1Q9OZbS0Fxz1sal27rDnfpCtZDn/sSsUyiKQJtncrbHXJQGPXtiFPoM c9OczwKJT4nP4uCSIzUGxVc/vnjYD09fMvrHUtHCabrhYEcOXK1v6+PzEWArzxFwpVxS 9AFnZ0yv68LtcjY95p+71uPDW/7AD6HQm/8UaAAKyap+rOjEs8YxVFMqPlABZnGGMxCk UsNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pLy4IHts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si2698178edr.173.2020.10.28.04.34.24; Wed, 28 Oct 2020 04:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pLy4IHts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793884AbgJ0PIv (ORCPT + 99 others); Tue, 27 Oct 2020 11:08:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1790254AbgJ0PEN (ORCPT ); Tue, 27 Oct 2020 11:04:13 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9104120747; Tue, 27 Oct 2020 15:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811052; bh=a9FoLFY3a0YLls1nteY7k/q1l1cCoVANCrzHmI05bkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLy4IHtskCeSDftfyuiz6MrMnR1lp69x4zuXnIdMtjt6D5fH1vT1fRHe28fDaJXZA o4OMaPfrNxRzktGxZcAbE7hsLDz6nwbWfVghQ28RQjobuZ2AnW1sE8w1CmKGZTxSnf ciJREniU/YYLdeWwni4/rILZTO6dTComAdigMSuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Kalderon , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.8 357/633] RDMA/qedr: Fix return code if accept is called on a destroyed qp Date: Tue, 27 Oct 2020 14:51:40 +0100 Message-Id: <20201027135539.434516310@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kalderon [ Upstream commit 8a5a10a1a74465065c75d9de1aa6685e1f1aa117 ] In iWARP, accept could be called after a QP is already destroyed. In this case an error should be returned and not success. Fixes: 82af6d19d8d9 ("RDMA/qedr: Fix synchronization methods and memory leaks in qedr") Link: https://lore.kernel.org/r/20200902165741.8355-5-michal.kalderon@marvell.com Signed-off-by: Michal Kalderon Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c index 97fc7dd353b04..c7169d2c69e5b 100644 --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c @@ -736,7 +736,7 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) struct qedr_dev *dev = ep->dev; struct qedr_qp *qp; struct qed_iwarp_accept_in params; - int rc = 0; + int rc; DP_DEBUG(dev, QEDR_MSG_IWARP, "Accept on qpid=%d\n", conn_param->qpn); @@ -759,8 +759,10 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) params.ord = conn_param->ord; if (test_and_set_bit(QEDR_IWARP_CM_WAIT_FOR_CONNECT, - &qp->iwarp_cm_flags)) + &qp->iwarp_cm_flags)) { + rc = -EINVAL; goto err; /* QP already destroyed */ + } rc = dev->ops->iwarp_accept(dev->rdma_ctx, ¶ms); if (rc) { -- 2.25.1