From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47A5F35FF73; Fri, 15 May 2026 16:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778862784; cv=none; b=p/xwzvCocz2Qqm80lynfGsdR5EeDZ1CCMMcRJzpiB+7BqIBI/TgQwfxxXmD7ef6VrjG4Nh7jq4ASBIs5SYeAP7hkbhxkrie9EmCcqEd00Sw4EWerFBD4TPJTMWjVSuPTbQRV/BSkrrAnmJCswXZg0cAznqOW7hp8TlIddvsELT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778862784; c=relaxed/simple; bh=PZLDtTSPIGOPb3Ej6ZCwa+d52tMTG8EhYHiAkGsqBd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MY9qCRpdrU1mV8AOybpyD6l1qVMRuOv4te7Ec9U6q2eXJyOfxL6XN308x+Tjb0YUSAs/Go4MvjnjqrQApyV1RXbCzZiMrgPFyeqEIYRR+601Zl3vyZDEEGYwB/csce2OhTLRAXOCLbZWZ3Gt6BODuAXgzFjpSB+PMPNI3lmhvbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aPFfa7+I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aPFfa7+I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA7BAC2BCB0; Fri, 15 May 2026 16:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778862784; bh=PZLDtTSPIGOPb3Ej6ZCwa+d52tMTG8EhYHiAkGsqBd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPFfa7+IKVKHN7YWnPu2TxvNkSFedD5bPCRw/S4r5P93SrRiwWsaPpRXpWoh06YU7 knGGOAOkwvyM24AERm0ZdpWmB+IssxlAONbFiK1f2JDvXuFK0f7F7++UP3V8HFpOtQ VnClljjv9g9oCXBbo+c6l3XY7+3jP6Bw9YKxqFZ8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Yuan Tan , Yifan Wu , Juefei Pu , Xin Liu , Luxing Yin , Jiexun Wang , Ren Wei , Sven Eckelmann Subject: [PATCH 7.0 174/201] batman-adv: reject new tp_meter sessions during teardown Date: Fri, 15 May 2026 17:49:52 +0200 Message-ID: <20260515154702.348094718@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154658.538039039@linuxfoundation.org> References: <20260515154658.538039039@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiexun Wang commit 3243543592425beec83d453793e9d27caa0d8e66 upstream. Prevent tp_meter from starting new sender or receiver sessions after mesh_state has left BATADV_MESH_ACTIVE. Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation") Cc: stable@kernel.org Reported-by: Yuan Tan Reported-by: Yifan Wu Reported-by: Juefei Pu Reported-by: Xin Liu Co-developed-by: Luxing Yin Signed-off-by: Luxing Yin Signed-off-by: Jiexun Wang Signed-off-by: Ren Wei Signed-off-by: Sven Eckelmann Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/tp_meter.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -947,6 +947,13 @@ void batadv_tp_start(struct batadv_priv /* look for an already existing test towards this node */ spin_lock_bh(&bat_priv->tp_list_lock); + if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) { + spin_unlock_bh(&bat_priv->tp_list_lock); + batadv_tp_batctl_error_notify(BATADV_TP_REASON_DST_UNREACHABLE, + dst, bat_priv, session_cookie); + return; + } + tp_vars = batadv_tp_list_find(bat_priv, dst); if (tp_vars) { spin_unlock_bh(&bat_priv->tp_list_lock); @@ -1329,9 +1336,12 @@ static struct batadv_tp_vars * batadv_tp_init_recv(struct batadv_priv *bat_priv, const struct batadv_icmp_tp_packet *icmp) { - struct batadv_tp_vars *tp_vars; + struct batadv_tp_vars *tp_vars = NULL; spin_lock_bh(&bat_priv->tp_list_lock); + if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) + goto out_unlock; + tp_vars = batadv_tp_list_find_session(bat_priv, icmp->orig, icmp->session); if (tp_vars) @@ -1464,6 +1474,9 @@ void batadv_tp_meter_recv(struct batadv_ { struct batadv_icmp_tp_packet *icmp; + if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) + goto out; + icmp = (struct batadv_icmp_tp_packet *)skb->data; switch (icmp->subtype) { @@ -1478,6 +1491,8 @@ void batadv_tp_meter_recv(struct batadv_ "Received unknown TP Metric packet type %u\n", icmp->subtype); } + +out: consume_skb(skb); }