Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2932124rwb; Mon, 15 Aug 2022 14:18:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7SeDz7Tgpxjpt93E3TTxBw5oxOeYVSk3UTEAqyRz7JUrv9QR4vQxWguloVUbEwh9qEyL8L X-Received: by 2002:a05:6a00:4509:b0:52d:4943:90b4 with SMTP id cw9-20020a056a00450900b0052d494390b4mr18268112pfb.22.1660597941986; Mon, 15 Aug 2022 14:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597941; cv=none; d=google.com; s=arc-20160816; b=hOvhmNyzaWb9rW8nhNF2P5TtJuIg96uw7kQA37/+ASBeAytjVAAS+LRTiSiISw4A75 SAcKoRVxw2qtIPyMy+aTGNF0VzJH6A06r21va+4nBi6FvJhH4EAIXBDs4zTy2lcJ66Pp LRdlyW/GxE6RX0jPH1ZZPR6IN6x5fK093SIzWrEGdCR51/+ABNu2McbQmusIhm+sloA0 0wJ12r4gvtIt9tAW67RYkJBVCKbsC03cLGx4D5wBbfnFiV5TRW/xfBaKZB1+IlXDBqi6 QqwbkFdIqwSxTn/A9Vf2bJxYi6Zhs3pGS613eA2+pBN5T7SYN/pQY7MUI9yqDb704vTY 5ahA== 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=TBhUZzpUprm2KCzxfGEDoLYRX8hh+JI0B8NmQ32GCUg=; b=ZhyE7iqGFgZiN/YsOpDXheSx/InkQ6t5z9RrPLojT9nh/Pu0qkdaknOHOQEFq5VJDB xh835h49V5ighh4L90p0zeAJp6RT1aX4UI1+aBkrPUzN0oN2MZBEhN/lwxzQraRjF+NR /e1w6IIutyzEyV9QVVQuSL227OC2qfeocRPNvHqQc3Qwb/b+uWD58HCbBlxLw+wx0nj9 QWnvMJ44bcil51XQRpT53vBBKtQZcWoTZTAEbdby0eOLC2aww14TjSQ525onPvWATY6V RNdi19UxTBY2zGZZEPRGxUz4lnDTOdqkbuhsVbQ0LLAmBs3FcLW3aUURd/RnxYqulz/j RAJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t0aGKtMJ; 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 u17-20020a170903125100b001708e1bb3b0si14452775plh.419.2022.08.15.14.12.10; Mon, 15 Aug 2022 14:12:21 -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=t0aGKtMJ; 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 S245338AbiHOTWo (ORCPT + 99 others); Mon, 15 Aug 2022 15:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343877AbiHOTS3 (ORCPT ); Mon, 15 Aug 2022 15:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A46DC3D5A8; Mon, 15 Aug 2022 11:39:46 -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 9909161124; Mon, 15 Aug 2022 18:39:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90799C433D6; Mon, 15 Aug 2022 18:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588785; bh=0r5UkRXI7xlArzqRPjOlHYSsnq34Y04hve0Lm1/L72c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t0aGKtMJqrBNZcgtY1C6lTftFQFHym9aoc64LerXGrSts5HmyMxXUmIqhOfjm42BI 7gG05j30ZsxU9tx7b0CSJiM9gQDNJKZ+ZFj+GkME+gqw810B+TPnQTatJKNDQXtTNi zOJcXOP7e7hwrf92YVh1XzMrNwWM7r6QwHOFfAC8= 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.15 513/779] RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event Date: Mon, 15 Aug 2022 20:02:37 +0200 Message-Id: <20220815180359.175400445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 18a64ccbb0e5..69d639cab898 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