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 22A9E26F46F; Thu, 2 Jul 2026 16:51:08 +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=1783011069; cv=none; b=Y2SDO2u0Aoay3GmXGp96u/VaziFdHzuwmcJkOHjo2z/vr2QXzR0fBG+VwwC0slio5AM3fzK1NDgQn6AOuWAK8hvsoLG6vsIQVr9Lb9Q7NRok2icEB32tzuLDVj3lc7yQuZPrCz25PXkFw5DNaDBcXyFKmZhNgh4IimZOf3YMjYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011069; c=relaxed/simple; bh=Wd2bbk5Odffd6mLC+BCslXVJnXNi6yEv+H7t5euqiMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CWmoBUNsrjWrhlQqOfG5fET9RBtSSZkSPl/E6AVdyFS4L0HCNCVcg1+DSXFt/P3Xz6TPotNMIa2HsgBZOFaV4X/GVaec/JNrH3Z4ie6GU6ZeiQqsUD7gtUulHOscTpydTesrKcScwFh0bEgLX2rW/5y2j4vTRJL6EBoIeKes3f0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TQ4asxRH; 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="TQ4asxRH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89BD11F000E9; Thu, 2 Jul 2026 16:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783011068; bh=KWTEjz4p4vx8/pn0Gx+hvijEJoWvWPYSMOueFa6bmVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TQ4asxRHdt01JBllAthi8i5F44YpWDPC9wyYGejvphwG6w2IazrItCM0/DNySRSqm eFdYn4vjaqWmipBGf9ibNdkN+eUFn60GDK0IoqdP7/ftoc4ZK8aWM4Na09jLMR6p+A Jow9mL+AeosIfuQbMyOu31nHOHhaE6IY+HzMGct8= 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 6.6 100/175] batman-adv: prevent ELP transmission interval underflow Date: Thu, 2 Jul 2026 18:20:01 +0200 Message-ID: <20260702155117.877299326@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155115.766838875@linuxfoundation.org> References: <20260702155115.766838875@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 5e50d4b8ae3ea622122d3c6a38d7f6fe68dfddca upstream. batadv_v_elp_start_timer() enqeues a delayed work. The time when it starts is randomly chosen between (elp_interval - BATADV_JITTER) and (elp_interval + BATADV_JITTER). The configured elp_interval must therefore be larger or equal to BATADV_JITTER to avoid that it causes an underflow of the unsigned integer. If this would happen, then a "fast" ELP interval would turn into a "day long" delay. At the same time, it must not be larger than the maximum value the variable can store. Cc: stable@kernel.org Fixes: a10800829040 ("batman-adv: Add elp_interval hardif genl configuration") [ Context ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin --- net/batman-adv/netlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 0c64d81a776174..03ba6282af91a3 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -938,9 +938,15 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb, #ifdef CONFIG_BATMAN_ADV_BATMAN_V if (info->attrs[BATADV_ATTR_ELP_INTERVAL]) { + u32 elp_interval; + attr = info->attrs[BATADV_ATTR_ELP_INTERVAL]; + elp_interval = nla_get_u32(attr); + + elp_interval = min_t(u32, elp_interval, INT_MAX); + elp_interval = max_t(u32, elp_interval, BATADV_JITTER); - atomic_set(&hard_iface->bat_v.elp_interval, nla_get_u32(attr)); + atomic_set(&hard_iface->bat_v.elp_interval, elp_interval); } if (info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE]) { -- 2.53.0