Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1777279pxp; Mon, 7 Mar 2022 02:04:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsAzQPnPAqIgguWy5PfF+UkV3I15uJYZ+yAzXK5e6JIYSr6B25gUYBOvcF6qGS2r6sgI9u X-Received: by 2002:a17:906:cc87:b0:6da:f37a:56d5 with SMTP id oq7-20020a170906cc8700b006daf37a56d5mr8154152ejb.444.1646647486010; Mon, 07 Mar 2022 02:04:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647486; cv=none; d=google.com; s=arc-20160816; b=ZsTA4hUUMftnwuF1Lx1YinZFtfaags7jORS32wEMzVfTCVBiV4mFZw3tKi4xNNK4zY TVllc1EqOxBQ2JNWax6e22Cfc8fl1+x1BNMHJaMdKcSEmoIEeF/h+FeZEtYq7cakjF5+ Iskvb2Cj4t6uqhkm4GGqJNVZnZ4gaVmVIT6eKM60+pXmJ0QTuFrfuFU5oJe3TAk1VznS JxruZ17b8RBK60WVE4cxRgmGwcGO6hD0RypNO466VuevFXWkxRZoj7BJ3eyXcX24yFe3 O3Ynrf5keedjN0ME73AY1OksUThKdqoMJc4CLE6TEpMRiCjbgjbw16bBPJEbva73jUQ2 77fw== 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=rLP2vWWPL0b+RPq3IwibF7dX+D7rIrCj82geMxcRZZQ=; b=YwRthajyKeBwnRgcyyFDzPEh34ReqSiG0aSysMnBS7J/dMxWYABn/CKUfxjGo0nrdP xwGU+bcAY/JjvqesQskTtv9hSartX0KS/KPrMOe7GUtrpcJ54cgZsIeq+m8sV2OcM/Ye 0zZUBKuslZwC0ZqlWw6R+whxxcccnhKa2AQABtLSqm8okMPiycpK6VX3dcqUNnHO9Tpm reBSZZLKmhfKcGaRnPmBHUeRQSqH/PH/IlBRDj8Rv2oj2B/Sk9D9VqTvxkbmKyycLszM bFTSH+3RXl5CNJ82oG42rA0fNW7frf6yW659jpOqQwzov+6rjxi5DmtgwfpBeU+yMX3Q 70Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ixTI0GtE; 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 k18-20020a50ce52000000b004132b7eb1afsi9067990edj.560.2022.03.07.02.04.23; Mon, 07 Mar 2022 02:04:45 -0800 (PST) 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=ixTI0GtE; 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 S237121AbiCGJai (ORCPT + 99 others); Mon, 7 Mar 2022 04:30:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237260AbiCGJ16 (ORCPT ); Mon, 7 Mar 2022 04:27:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C0866FB2; Mon, 7 Mar 2022 01:25:03 -0800 (PST) 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 0F044B810C6; Mon, 7 Mar 2022 09:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E921C340F3; Mon, 7 Mar 2022 09:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646645089; bh=TzQRSrAz9SiHrwxvFF7z46dX34BmS0UHHuyiusNHL/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixTI0GtEItSsMpkGg7DTYr5I92mgJJGJjFi2P19Y2GmtTxrs/2zj0DvzRN1eRnvEO 0VU1OS0EtDGBLAJ0w2ZmdLjw9yJgEzefDOIcAwDILaiDPMOnlQDPF+kmtlQYuJYrQk apQZ+j6WKl2SUpX7OL1Ky8EewqNvX21T8SLvff24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "D. Wythe" , "David S. Miller" Subject: [PATCH 4.19 27/51] net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client Date: Mon, 7 Mar 2022 10:19:02 +0100 Message-Id: <20220307091637.765051159@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.988950823@linuxfoundation.org> References: <20220307091636.988950823@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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: D. Wythe commit 0537f0a2151375dcf90c1bbfda6a0aaf57164e89 upstream. The main reason for this unexpected SMC_CLC_DECL_ERR_REGRMB in client dues to following execution sequence: Server Conn A: Server Conn B: Client Conn B: smc_lgr_unregister_conn smc_lgr_register_conn smc_clc_send_accept -> smc_rtoken_add smcr_buf_unuse -> Client Conn A: smc_rtoken_delete smc_lgr_unregister_conn() makes current link available to assigned to new incoming connection, while smcr_buf_unuse() has not executed yet, which means that smc_rtoken_add may fail because of insufficient rtoken_entry, reversing their execution order will avoid this problem. Fixes: 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers") Signed-off-by: D. Wythe Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/smc/smc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -321,8 +321,8 @@ void smc_conn_free(struct smc_connection } else { smc_cdc_tx_dismiss_slots(conn); } - smc_lgr_unregister_conn(conn); /* unsets conn->lgr */ smc_buf_unuse(conn, lgr); /* allow buffer reuse */ + smc_lgr_unregister_conn(conn); /* unsets conn->lgr */ if (!lgr->conns_num) smc_lgr_schedule_free_work(lgr);