Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3094514rwb; Mon, 15 Aug 2022 18:00:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR42MGtEstm47THDtpRlu5CpKHsHhtQNnCqEn5NhDLQmFi1Wl9mCeGYmgtA86ayragUnkqg3 X-Received: by 2002:a05:6402:3689:b0:43e:43d6:6039 with SMTP id ej9-20020a056402368900b0043e43d66039mr16890536edb.341.1660611602440; Mon, 15 Aug 2022 18:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611602; cv=none; d=google.com; s=arc-20160816; b=LkGeUEs4QLANXVd1R6EewbGz8mMoJ70+BFHRH7qudbUtezEew1jifLDwmJWZcEB7v+ 5CV5Z66VCnzSZgj8RtoSxmPQQOGm9aFH1d3OIo4/w6xbmIYL3tqxZgWTXF+Pn8VwVXIm xoT1P/0azJyq2162fV4zC1K9cGbnmuuGdWt4dwCsSFIdEikx2s8IuMYt9/IClPmH/p3z GeN584ReNMzBaDeEFGh1Bz2KYQUjh7IjbiNJkaVmeZnZ37c05zNJSc4KM5xTCYhHB8am g0JR01G3Gti8gFux+oUUsLWcfGrkA8LAvGBcIAD56XGcNTHnunt6G0K8Bt8tg0aLsijM 0zuQ== 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=ckxwiY89FDylgml7hG9jBgeQ1ly+wZuec1wj2SmmTq4=; b=nXSqVVJZo2/N0nd2WXZX/AS6/UjQ8ZfKKVUkvDTUGKntZbbrDFfqskbmCwRiRfJNWX BBVvHEihcgwCLwjAdyShM8ndkY1l797EJzv4HrpFjK5MoJOVmLHKkuYHVWooulwg+1Il Kvu2ptL2HexQxPVsv5sa0/blvicTh1FEitnWpX8+WBN8c4i79KnK4QyEpZ/KeR9zzoZx dPOObBkyCcqjGCPdcDxd6o0xcRjEKrFxzL1NZ872/0vrM3ny4Znm/hO0UFHg+8NJZbYc EjmOOgDdqOA1ZihmPn63P5xu3J+GaHSoFDCEpvw5l65P7ZHonJ4LXVBZbEUTnXkccU0S fDug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T4nVmrJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf6-20020a1709077f0600b00730babc11e3si11362960ejc.640.2022.08.15.17.59.33; Mon, 15 Aug 2022 18:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T4nVmrJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351771AbiHPA3e (ORCPT + 99 others); Mon, 15 Aug 2022 20:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351671AbiHPA2f (ORCPT ); Mon, 15 Aug 2022 20:28:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48CE11815EE; Mon, 15 Aug 2022 13:35:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7342F61089; Mon, 15 Aug 2022 20:34:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62C0CC433D6; Mon, 15 Aug 2022 20:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595659; bh=RZ0vulzf7UEz5azfjdo4BMoZmo2urF2aS/b4lpbo9RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4nVmrJVCUcW29YZk3RtD68jptF+tmi3rG7Y3oY1wFihmk3PPEoYpUfNoY6uU8hz/ xgyjYqZhydlHth5EWhgQJUnorL1Bx/YB15/ExUpuvVy+urt43Eb7hmZx4sSeuiRVyW EX8RFYMoai1FSiRDP+2uAHJbUNtewb9KaScleL2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cheng Xu , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 0827/1157] RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event Date: Mon, 15 Aug 2022 20:03:03 +0200 Message-Id: <20220815180512.565150706@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cheng Xu [ Upstream commit 3056fc6c32e613b760422b94c7617ac9a24a4721 ] If siw_recv_mpa_rr returns -EAGAIN, it means that the MPA reply hasn't been received completely, and should not report IW_CM_EVENT_CONNECT_REPLY in this case. This may trigger a call trace in iw_cm. A simple way to trigger this: server: ib_send_lat client: ib_send_lat -R The call trace looks like this: kernel BUG at drivers/infiniband/core/iwcm.c:894! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <...> Workqueue: iw_cm_wq cm_work_handler [iw_cm] Call Trace: cm_work_handler+0x1dd/0x370 [iw_cm] process_one_work+0x1e2/0x3b0 worker_thread+0x49/0x2e0 ? rescuer_thread+0x370/0x370 kthread+0xe5/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: 6c52fdc244b5 ("rdma/siw: connection management") Link: https://lore.kernel.org/r/dae34b5fd5c2ea2bd9744812c1d2653a34a94c67.1657706960.git.chengyou@linux.alibaba.com Signed-off-by: Cheng Xu Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_cm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index 17f34d584cd9..f88d2971c2c6 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -725,11 +725,11 @@ static int siw_proc_mpareply(struct siw_cep *cep) enum mpa_v2_ctrl mpa_p2p_mode = MPA_V2_RDMA_NO_RTR; rv = siw_recv_mpa_rr(cep); - if (rv != -EAGAIN) - siw_cancel_mpatimer(cep); if (rv) goto out_err; + siw_cancel_mpatimer(cep); + rep = &cep->mpa.hdr; if (__mpa_rr_revision(rep->params.bits) > MPA_REVISION_2) { @@ -895,7 +895,8 @@ static int siw_proc_mpareply(struct siw_cep *cep) } out_err: - siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); + if (rv != -EAGAIN) + siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); return rv; } -- 2.35.1