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 D5B0D3A7F49; Thu, 2 Jul 2026 16:27:37 +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=1783009662; cv=none; b=tAFOtLXt9Y66YIZaNjrxe7SrJ97l7G+DuCJ2N4ZWHL87n7PhEPUR4w/eNiZpg53t0AKWG1a8DZPEunD5c/j4IXlrmq8p4zJY9Lre9nFy/8OdBPZmZpWtgyh+9vH10P48xp1Oi625HMqmwwC4kiH8agIQUERUu1cyTeSpq6NCHSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783009662; c=relaxed/simple; bh=sssfKFNrRvOA6/NUY5usicKmFBnz49nZpSlIPSS5pqM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SpsljfOvI15zyAcYfm0Twc1hP5hxVUIV7huSRzA+fLNGt9puezFS6xDQvzA0SDHAEHbvtLCoh+xiDz837/gnTS95OJtDEyjQmOK5QiHtW2VYxmDaqwzrUHV87GXsht6FbBMWkq7Oh5SPB8x+uKMbF3vDUj/IMtblGlYNlkZV+pM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ESJ7A7+y; 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="ESJ7A7+y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC10F1F00A3D; Thu, 2 Jul 2026 16:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783009657; bh=WMNtuLN4VwQFQi5OAY7UxTiH+QRj7Oo9hnI3m+yB7FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ESJ7A7+y3EoN+cik2dN8PWbNtEHlEBM98fdQbsE74QoL1lhgz1m9tp29fhYxm6uNX xdsHeyVwmFTNzEov7j4hfZdOFMJvco/Wbkp+lKCoEe3XdUfU+E38C/oHr6iBU5O6id xm4jg6Qbnsf/4HYe8auGyx4gEqJAGcWYQ4i5ad0I= 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.15 37/95] batman-adv: prevent ELP transmission interval underflow Date: Thu, 2 Jul 2026 18:19:40 +0200 Message-ID: <20260702155109.988424955@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155109.196223802@linuxfoundation.org> References: <20260702155109.196223802@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.15-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 bbd6ecf1678c97..cb50b46cb8d30d 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -941,9 +941,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