Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp231127pxx; Wed, 28 Oct 2020 03:32:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjgC2ici6Wd/vZgDhqMd8KygJizZW0TcjEMSeOGTm5pp5k9E2QNo315T0ydee+zcT7CKbC X-Received: by 2002:a17:906:141b:: with SMTP id p27mr7092256ejc.205.1603881153989; Wed, 28 Oct 2020 03:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881153; cv=none; d=google.com; s=arc-20160816; b=HGlrmatvdtdbY8gr7MptGbZkzkslEUja+0q40feXhKJNHm+Zx2SraDpHjiNQlnl7u1 Z8xFBf55EA1igzpk1mQ+nG9InR7AGZeip2pRCsDBJz4fPR8AXTgfASpwp4vZl7nPAsid ReH5VGUo/3TgyF1B+dTPoYCnnPWu9T5RVdOR1zZbv4xVuL4vAFFaP4dlX4rq4umRxL+C ORn/yqWffINmMWJfaAce30W7eP8TndwY/JFpll3Fsad17GRwRGAe89rBj6FSnjf5YiVI BAXrIwfC17WigDLKHsz3IHc7w/rDl5Vd3o5IEexzVAmHyEEuvtPDf64jPctRgFa7RfM6 Ah8w== 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=L4bP/FhBds4M/b/Up7E5ItRLGCyrEnv/c5Z8DuhAU0w=; b=FhInnFrOz3cGAKbk1o7l1zgbGgGzxEeO6Qrjf8HY8FfCNXhfRuRPLzGCBMt/iaoa47 KHF8WJ0NOey1ejKEf/vpCycW1DTaw2z1hefX9g0gbFqbL4iMeCOoiiAP5sJ3J9HqvlGv /GWgCd6hXfsqU61SxvTalwhHai6rDtbuSXj7EFKRrSn4TbMJwcpwA2EKY8ZwD1x1EcXP N05XbNiPyCcnJHjUAW440d9haIiyaXBtyxbRM6shhIMym04d5D5+dScnHZcVs5HP6bqE cL7vOgIObIJ09vSxHJ5gmp509KpmGLFP/EHrlyuMbhv99ojZHVUXVtIOb4/7lwmqRpu0 Hfaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FOHYdrNo; 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 w17si2969573ejk.629.2020.10.28.03.32.11; Wed, 28 Oct 2020 03:32:33 -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=FOHYdrNo; 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 S1762462AbgJ0Om5 (ORCPT + 99 others); Tue, 27 Oct 2020 10:42:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:39112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S368433AbgJ0Ojt (ORCPT ); Tue, 27 Oct 2020 10:39:49 -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 6BA4D207BB; Tue, 27 Oct 2020 14:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809589; bh=8T3C3yGbv1I4fkDmbgplAors2UHRXMhqrjsEcsuGhY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOHYdrNo0lXYvXWKJeo83wZRykVYLbeKeO3ASJtZ7Iu+Q5h9nrjX1wctDlmeSPs3E BZ+OwEG2+ZTKTNxH1ONnjc+TT79kh9jiDqU0b/d6WOSSGf4Y9VWuz4aJ8JiEDLu4EA ZurRHb2LuwNPHjgrs7sGaAYbnrox3tM881uAyKCM= 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.4 220/408] RDMA/qedr: Fix return code if accept is called on a destroyed qp Date: Tue, 27 Oct 2020 14:52:38 +0100 Message-Id: <20201027135505.290399428@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 6dea49e11f5f0..e521f3c3dbbf1 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