Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1866431rwb; Fri, 19 Aug 2022 10:41:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6DaA7xI98EKtlTh4EuLAtjk1FKFmXzLVHNoCw/A7tAi6Bs72cnjk9lSK+XnWz1UQHJu4TO X-Received: by 2002:a17:90b:4c07:b0:1f5:40a:8047 with SMTP id na7-20020a17090b4c0700b001f5040a8047mr9782107pjb.44.1660930894162; Fri, 19 Aug 2022 10:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930894; cv=none; d=google.com; s=arc-20160816; b=s5UoEOtGqwBJzwGCh2j+EJOKehyOi/VwEq9TRzDX28olPnDin/gxLbTaUfIFpKDhtw X5JN/KV91/9BiEE/VQ4vv5xsStz69HkqtC4MfM4O1IdRKk1jfhgDbrx6FuQ5j8loUnLZ EnzQGn//nf5HQJ0tWKXaWWhyvRcKsbGbyHQ3OCWKgzFD4zNE3xIQQXkfOiYKdwmoyHUG jxczwlrggUXH+jJoDaOt54plqI3NRZWM/G8fnPF4otBZloZHA4hbMQP7KRsKWC1UAg4N CFuZIhAsHauuHtCyT/1kvryeRiZlfUOBw7TlewtvdqbhV/izC9+tmp0V82+G8MOi/1N2 64bQ== 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=43+FQVnExQyn1TmsoXYHLg2gzH6VQpMtRHMyggRQIVU=; b=uxypMDPkDxvE4VueCCH3qVvVA9HMdVhhwwxf9og2ATYzsXFK6IUc7SFbb6VBIRoTE5 6c3DYR8EXhkjB+MfYptxVk9xUOGbz+yyTgCHNvpfwVMZONwvmxEM1rbtlk1jySm/XGRz maHpGY7i4bSCdgkOdhSbYnkkrKTD3h2VcvFHWb/NbXI/ZvNp1cluyRhusb/KYwxQCahO QHwTfMezphbbaFQxhhQocZIeBYEpfTEGCSfXYGOcQOVOimXOIzg2ZCIDow52b60+ssAB 50P/wu0IbKCdYkuqkXzOrcaRBDaXvQyXduMapPN/Lr2U7Y83Q6xXUdptWyWvYgZKV6/a H0tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K5LrtWGY; 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 y2-20020a633202000000b0041d35693195si4626720pgy.67.2022.08.19.10.41.21; Fri, 19 Aug 2022 10:41:34 -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=K5LrtWGY; 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 S1352639AbiHSQ0r (ORCPT + 99 others); Fri, 19 Aug 2022 12:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352159AbiHSQVS (ORCPT ); Fri, 19 Aug 2022 12:21:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB164A98F4; Fri, 19 Aug 2022 09:02:45 -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 ams.source.kernel.org (Postfix) with ESMTPS id 06EB4B8281A; Fri, 19 Aug 2022 16:02:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 466A0C433C1; Fri, 19 Aug 2022 16:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924962; bh=Ue5WTpNkr1YCPFe7K+gnxnV31/gUq1gsXowARGuCpMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K5LrtWGYIoTSShYRH4/OaD8fYGqMN6JNAqnn83qQqXNAtVGvX6lRgxy/XKxi1Glph I9gM26YsBB8/Ak+XCHscBlegRQzL+A/mZcb8P9FHyOLYENpGIraKq1VNmJe30ut8xy lroBuRgdIRGP7GlDvELcWFEgVTWqMCGKvlIFHUZ4= 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.10 338/545] RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event Date: Fri, 19 Aug 2022 17:41:48 +0200 Message-Id: <20220819153844.520448682@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 6e7399c2ca8c..b87ba4c9fccf 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