Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2204860iof; Tue, 7 Jun 2022 23:09:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7t8PjsJVws3uqI5XJQl/qUSxXBr9klDEF0hvdECCOGkYXJserZ+a+u/wRqWMNYBoEIKgQ X-Received: by 2002:a17:903:41d0:b0:167:68a7:c31 with SMTP id u16-20020a17090341d000b0016768a70c31mr19266676ple.49.1654668543642; Tue, 07 Jun 2022 23:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668543; cv=none; d=google.com; s=arc-20160816; b=uavAojkc+2nmK0wJbU/xmcih6xfavKs+vG9KT9DDHgAB2/MMkJkra9qslKtFZA109g x2v/kiRTZVEsoC9uxD+CmgXR6xx72el/5azL2gSZedz/oCmvWnLqMu9ixC9LhCVWNzHt gRgr008MT15g6KttL/CzsFlyFqnIIr16XlEi/yPzvLxHiQTYpF3AFYglFk0IJUAovqak IdrMEMBvYudokhDX18wZh5+guSbDH1K+Vblsz+gm5/HSYAYe5sABZh+FGKkpzVeBtWy6 20td6+CWZOp1vS96vOKE1AEmo5TfYXRq2QozvVipIr/d9UYXQJjLgl6jbNh6mJFziXsO yr9g== 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=k0SMLSsT1Z5XAYxAGuq4QM8f6QUvkse2hlQsw9nTr34=; b=pVU7somdB33MGQgcc3cWRPlbZ8tr+7uF4UpKjP0OPavzYaL7jmMuMfSkRdTs4qBaCd WL5rkDnPvcsNsjvUXzUCciPBPEwytTt+Zm4aL5XF4brVFc22aPZrd/0xDgc6hTgoNOd7 vjk3WZG0n5k5htqRhQQRi/1L0VmdguYjQ00RSyb3nbGtpU3OEVcD+2AJazPupopYzdcx JREba73Ha/iFRZtYOU9OzW1e426LCHJc6v1zokdiy1edyTaBGGPInrh7fiPE0fcgLa6K 8VlD85F0YSe5DdoO5zU29jiEJo58nyApDVBUEmpZ5FWrMDUqH3OQN+TII402CElpT9Di kytg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w83Ie8Hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k15-20020a170902ce0f00b00163ef8dee02si27218088plg.391.2022.06.07.23.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w83Ie8Hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2BFF41FDE8E; Tue, 7 Jun 2022 22:31:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386978AbiFHBhV (ORCPT + 99 others); Tue, 7 Jun 2022 21:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382537AbiFGVvd (ORCPT ); Tue, 7 Jun 2022 17:51:33 -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 38B1523CF4E; Tue, 7 Jun 2022 12:09:00 -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 8C966B81F6D; Tue, 7 Jun 2022 19:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4185C385A2; Tue, 7 Jun 2022 19:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628937; bh=3OKsLM3PdTvFsnGDdJ4gnDKs9haShgP9DYiKDLfyvtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w83Ie8HhbQUvQFX42gXjsoODi9LahIsQATLCA2TW2tAR3MWzhBIt25wXCrTueShwN C+Cw+cqDfSCiJFOSDZZn9uOfIOzKMz9rxBNyImM1fQ0CmQb532aeVhVQAFSdmSLJy3 lI40dC951Qx8eJGrSjeIiPQrSUOr13Q5iNGewsas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 511/879] amt: fix gateway mode stuck Date: Tue, 7 Jun 2022 19:00:29 +0200 Message-Id: <20220607165017.708001334@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Taehee Yoo [ Upstream commit 937956ba404e70a765ca5aa39d3d7564d86a8872 ] If a gateway can not receive any response to requests from a relay, gateway resets status from SENT_REQUEST to INIT and variable about a relay as well. And then it should start the full establish step from sending a discovery message and receiving advertisement message. But, after failure in amt_req_work() it continues sending a request message step with flushed(invalid) relay information and sets SENT_REQUEST. So, a gateway can't be established with a relay. In order to avoid this situation, it stops sending the request message step if it fails. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/amt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 10455c9b9da0..2b4ce3869f08 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -943,7 +943,7 @@ static void amt_req_work(struct work_struct *work) if (amt->status < AMT_STATUS_RECEIVED_ADVERTISEMENT) goto out; - if (amt->req_cnt++ > AMT_MAX_REQ_COUNT) { + if (amt->req_cnt > AMT_MAX_REQ_COUNT) { netdev_dbg(amt->dev, "Gateway is not ready"); amt->qi = AMT_INIT_REQ_TIMEOUT; amt->ready4 = false; @@ -951,13 +951,15 @@ static void amt_req_work(struct work_struct *work) amt->remote_ip = 0; __amt_update_gw_status(amt, AMT_STATUS_INIT, false); amt->req_cnt = 0; + goto out; } spin_unlock_bh(&amt->lock); amt_send_request(amt, false); amt_send_request(amt, true); - amt_update_gw_status(amt, AMT_STATUS_SENT_REQUEST, true); spin_lock_bh(&amt->lock); + __amt_update_gw_status(amt, AMT_STATUS_SENT_REQUEST, true); + amt->req_cnt++; out: exp = min_t(u32, (1 * (1 << amt->req_cnt)), AMT_MAX_REQ_TIMEOUT); mod_delayed_work(amt_wq, &amt->req_wq, msecs_to_jiffies(exp * 1000)); -- 2.35.1