From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 EA84439A047; Thu, 2 Jul 2026 16:23:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783009431; cv=none; b=DFQ46MoMMPTA/cyHII9Lqxie9xDYQJtwKJuueW1eYHvYKmdW0bxIJDj71HDQuamch/3VlrE2b3UsUG20u4E53G5+ry+dktAGXgixU6Of6QZ5n7uRJrtfsrJD2nYJ4dEjFoTrivrWB9UnmY0wPGvRdtXhHXiJmg/RkJn3ELI/bI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783009431; c=relaxed/simple; bh=obBtH4X5TCfEMyG1yGxsFSk2a8GGB2aRlN5toZ+KgIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BOET3KWBUoZkNRyv26h3isclgD4cUGEbzPT+Fx+7E0lk+mtfy86CiERSwZjaSW4R0BxuhPmNM1nT1eIr1MgLqJRtLLx5OgpRZ1jrbFm4185HdBDVQmaYbPWrDiHbGcCWEf9a/LuxbwFdTfPI43MqrycaeIxknTksAQV3FhgasM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lO1UKmT7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lO1UKmT7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 879BC1F00A3A; Thu, 2 Jul 2026 16:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783009424; bh=xg+0D/bsW64mWScSffNPI4KICOUY2OhhqZ9LpnVR68U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lO1UKmT7aVLqMTbC2SK6XfZ8TK5sUta/L3SPi8x9Sf2BJH+6J7yA0h0RKs7q+Jqwq 2wpNCLr1OuLluzU+sSE9sf3uMSCT1aMjQvCF7E2srWokUzlcBamMbRoBiaptW42Jo8 qtaUdASCyWpkjVaChP6xcXgmqeRPp/yL3Fw1DkLA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Sven Eckelmann , Sasha Levin Subject: [PATCH 5.10 44/96] batman-adv: tp_meter: initialize last_recv_time during init Date: Thu, 2 Jul 2026 18:19:36 +0200 Message-ID: <20260702155109.912069981@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155108.949633242@linuxfoundation.org> References: <20260702155108.949633242@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann 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 Signed-off-by: Sasha Levin --- 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 a015ff73812f5e..ea5640242ddc2e 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1412,8 +1412,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, @@ -1440,6 +1442,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); @@ -1488,9 +1492,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.53.0