Re: [PATCH net 1/1] batman-adv: stop tp_meter sessions during mesh teardown

Sven Eckelmann <[email protected]>
Newsgroups org.open-mesh.lists.batman,org.kernel.vger.netdev
Message-ID <177712692887.34614.2289598356887428944.b4-review@b4>
On Sat, 25 Apr 2026 20:59:16 +0800, Ren Wei <[email protected]> wrote:
> [...]
> Reported-by: Juefei Pu <[email protected]>
> Reported-by: Xin Liu <[email protected]>
> Co-developed-by: Luxing Yin <[email protected]>
> Signed-off-by: Luxing Yin <[email protected]>
> Signed-off-by: Jiexun Wang <[email protected]>
> Signed-off-by: Ren Wei <[email protected]>

Thanks. I have some minor notes about the patch:

>
>
> diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
> index 2e42f6b3..028cd4e0 100644
> --- a/net/batman-adv/tp_meter.c
> +++ b/net/batman-adv/tp_meter.c
> @@ -947,6 +964,13 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst,
>  
>  	/* 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);

Hm, this looks a little bit out of place. Maybe split it in a patch for
handling the starting part (this) and the rest (the shutdown handling).

> @@ -966,7 +990,6 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst,
>  					      bat_priv, session_cookie);
>  		return;
>  	}
> -
>  	tp_vars = kmalloc_obj(*tp_vars, GFP_ATOMIC);
>  	if (!tp_vars) {
>  		spin_unlock_bh(&bat_priv->tp_list_lock);

Why was this changed?

> @@ -1342,7 +1362,6 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv,
>  			   "Meter: too many ongoing sessions, aborting (RECV)\n");
>  		goto out_unlock;
>  	}
> -
>  	tp_vars = kmalloc_obj(*tp_vars, GFP_ATOMIC);
>  	if (!tp_vars)
>  		goto out_unlock;

Why was this changed?

> @@ -1478,9 +1500,57 @@ void batadv_tp_meter_recv(struct batadv_priv *bat_priv, struct sk_buff *skb)
> [ ... skip 12 lines ... ]
> +void batadv_tp_stop_all(struct batadv_priv *bat_priv)
> +{
> +	struct batadv_tp_vars *tp_vars[BATADV_TP_MAX_NUM];
> +	struct batadv_tp_vars *tp_var;
> +	int count = 0;
> +	int i;

size_t count = 0;
size_t i;

-- 
Sven Eckelmann <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.