Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1775599pxp; Mon, 7 Mar 2022 02:02:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfQ+9joIkXhYxb3rmCaP06CXuxon2R7le3UNVCIhI3fdGC7Zqyv9sxWuS/+X1UUX9cU1Fm X-Received: by 2002:a17:90b:1a89:b0:1bf:7508:9f6a with SMTP id ng9-20020a17090b1a8900b001bf75089f6amr1503534pjb.201.1646647364085; Mon, 07 Mar 2022 02:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647364; cv=none; d=google.com; s=arc-20160816; b=ENclGRvMHN5K/b6L6YsRqpupRSI4T0QUwt7QzfhIwAZZ+2R5LnZa9sxywwxdNejHVw dYqjdDyqH06/KwbIpE8kSn3KBbtt2iEwG8/9Oct+PC2IaASeOidoqUk2SyadLKEXOkCy mirgxLhbVJKuZ4ocCX0gN/fDDhpyJ/UXS39Oy0MhR+UmBo0+2ZCebyUt5iDwl1V61hYL F42ZMTZ5pzPFZNUMmLcaI1pYuQqJUL2497hv6fhb3yT3lS39DxfgOik1vLB+xBnB+2pa KpV7bMRNGW3rpq1GUn5IUrcxEBJwCxmjpoYoslAfNBWVngPn8hDRcC/VoTutZIE7I0iB b7lg== 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=bZpLYitUxnxCr8px8zxgVF3s46J5Oyc4pCUhxMhWQBs=; b=q7arW5wCFaRx5Vi7PtJBD5zJZdmst9lntNAqilfkbsKMOjDnMm1HgGlEzJIK3alURY Yu4PVdafr9lD/oz0urIn5eEmcirtN++1/u1O214xQVfVhLZN+MkLvarImjYUxZCSD06w Cd+uMgiU7wX24ua5kU3a+cmryeBjhR9nuQhJA7OKbvBKi4k0OWX2nXQHRG7exBDDoGNY yTYWc1Ij10y0s/07g3CuF3hmBASoiZzROLN+ZzDOsC4PmMg0EdQ0fB0ZgmoH7MeDxVJA Dc/TwcEfn2U0dmHE1oWoLgW1vsLmfeGvAeIEPxaiDNZrHPSEcFXvVRN+VYfwCaeKpHo1 ZhrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="GmlMndw/"; 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 t15-20020a62780f000000b004e0cfd7ebf0si11486732pfc.321.2022.03.07.02.02.30; Mon, 07 Mar 2022 02:02:44 -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="GmlMndw/"; 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 S236695AbiCGJZG (ORCPT + 99 others); Mon, 7 Mar 2022 04:25:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237420AbiCGJX7 (ORCPT ); Mon, 7 Mar 2022 04:23:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5706155777; Mon, 7 Mar 2022 01:23:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BBD2460C00; Mon, 7 Mar 2022 09:23:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3A54C340E9; Mon, 7 Mar 2022 09:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644985; bh=+/Uc3Sdp0v0Q53xaBBvjihDFMyurghmuwZ8ogDXLmdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GmlMndw/TSB8COpN25uNr9BQ4LJFV7TWGoRDYdE5eJDCdvY4i+LzRdRW1ENTrAWL0 kmwP6AycA9AcKIX41ablnoRPr6wMkYQQYMkqJHm5iGhLS0sdPf9qtJxr0zLt9fQLrE KQLrMHT0S+vnHVHHs9FV/9D12+LQ/bXoSYoBS6ng= 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.14 24/42] net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client Date: Mon, 7 Mar 2022 10:18:58 +0100 Message-Id: <20220307091636.855596273@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.146155347@linuxfoundation.org> References: <20220307091636.146155347@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 @@ -239,8 +239,8 @@ void smc_conn_free(struct smc_connection if (!lgr) return; smc_cdc_tx_dismiss_slots(conn); - smc_lgr_unregister_conn(conn); smc_buf_unuse(conn); + smc_lgr_unregister_conn(conn); } static void smc_link_clear(struct smc_link *lnk)