Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) (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 CD76F3F8EA2 for ; Fri, 26 Jun 2026 16:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.73.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782490292; cv=none; b=gf7tewk5vXQgV0JBGq7T55p5ucn1yy9maoYOhqbQAHsT3moigLPBQGTYiBZxdvyD0COtLV6LOLam3rTGqnPT41Rp9hzg+SoVUrPlluBA1WMVwD4tp2UA+tgbUBL6rHXmr9OcwEOmclWE0a4ttepS7RtDkWNpralMqLzpLZ1I6Qk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782490292; c=relaxed/simple; bh=b5gzHd/ZDOLO6CwBl/kSauf0a1WiXKnU/eypON4vOmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uEwH/gSJcd4qfWgGHDrRwUqrFR7JXue6rw5U/LKZJaJBSj+oI504du0MBpSD42lxwvMXef3cy3C/QXhg8ngppGBWF0pZTeOnBCcbQZSKl1jrqFKKYM5XEMNz+RxQ5hTBZeEki92mskh+0p9BCw3SM1xuy1WISKOU5Tnvoa53+4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org; spf=pass smtp.mailfrom=narfation.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b=eESgFTiI; arc=none smtp.client-ip=213.160.73.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=narfation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="eESgFTiI" Received: by dvalin.narfation.org (Postfix) id 31482203F3; Fri, 26 Jun 2026 16:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1782490289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EVy+I0oucJQCDillfS9VtPVj6J3KWpzvO7x+xAlANUs=; b=eESgFTiI0JqBvYcuu+S8BjHARUw4GMDasBHJm3tCscsJNNGSsfYmSiWM9FzH/WR1bKIY83 P7damgnalICnwC5Qpyj7zOmgdqOIbxvgezywfb+xXf6uyhJLKSO1/JCyn4e9Rv1r6vaNl7 tCMh2Ial//2F48PGzVD4CBRZMhHfGZY= From: Sven Eckelmann To: stable@vger.kernel.org Cc: Sven Eckelmann Subject: [PATCH 6.1 11/25] batman-adv: tp_meter: initialize last_recv_time during init Date: Fri, 26 Jun 2026 18:11:09 +0200 Message-ID: <20260626161123.124273-12-sven@narfation.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260626161123.124273-1-sven@narfation.org> References: <20260626161123.124273-1-sven@narfation.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit commit 811cb00fa8cdc3f0a7f6eefc000a6888367c8c8f upstream. The last_recv_time is the most important indicator for a receiver session to figure out whether a session timed out or not. But this information was only initialized after the session was added to the tp_receiver_list and after the timer was started. In the worst case, the timer (function) could have tried to access this information before the actual initialization was reached. Like rest of the variables of the tp_meter receiver session, this field has to be filled out before any other (parallel running) context has the chance to access it. Cc: stable@kernel.org Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation") [ Context ] Signed-off-by: Sven Eckelmann --- net/batman-adv/tp_meter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 2bba53fc6da5c..133eed2fa9507 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1403,8 +1403,10 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv, tp_vars = batadv_tp_list_find_session(bat_priv, icmp->orig, icmp->session, BATADV_TP_RECEIVER); - if (tp_vars) + if (tp_vars) { + tp_vars->last_recv_time = jiffies; goto out_unlock; + } if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM)) { batadv_dbg(BATADV_DBG_TP_METER, bat_priv, @@ -1432,6 +1434,8 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv, kref_get(&tp_vars->refcount); timer_setup(&tp_vars->timer, batadv_tp_receiver_shutdown, 0); + tp_vars->last_recv_time = jiffies; + kref_get(&tp_vars->refcount); hlist_add_head_rcu(&tp_vars->list, &bat_priv->tp_list); @@ -1480,9 +1484,9 @@ static void batadv_tp_recv_msg(struct batadv_priv *bat_priv, icmp->orig); goto out; } - } - tp_vars->last_recv_time = jiffies; + tp_vars->last_recv_time = jiffies; + } /* if the packet is a duplicate, it may be the case that an ACK has been * lost. Resend the ACK -- 2.47.3