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 6EE5A37A83C; Thu, 2 Jul 2026 16:42:57 +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=1783010579; cv=none; b=TlxHZHWudaNvlAXVJPFC4VEkvs2ayVsFUJaqvsdJbHr8NtLnYA4G3YRSpqodL4dfTVAB41tuuur/DEBllr5uuZMjf1aTFEhieFZNBFxL2IkQ2nzALZH7ExB+eahH+TGx/eWTjA2g8/m7+FQzjKxhaqbDPeQwGKcQE9R0uqT1i+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010579; c=relaxed/simple; bh=IN2pvlcvGvbPCDZ6fn9/ySHshIoOriaSmNzVx9jW4SU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m3XgzfHMn7yyg5a+vVum7TFV85FIhdhjpxEIZj2+QMpudk0TUQWq1bJu9Kp+BTgEO0/UoulJMkpNe3d/jih2vc83+wQOv2bG8n3R/5N6xP2ZdSvOvCCE7Gx8om7ve3Ua/+glg9zRPGNYXT+R2JYSlDJHm6bf0ZGZv3pzTMgKBLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zUZVmKKA; 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="zUZVmKKA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 802921F00A3A; Thu, 2 Jul 2026 16:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783010577; bh=/nTF1NT57pSxMycuMBrCJwEUw7knoIcs7+7btOc84lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zUZVmKKAqE37GTrYzwZE3unkbQG+qD81LBmbvObvba3zxKPDoBf8UggV7/YifjE9/ 5TbSjZiEkZqtNoPU5ygWTsU6BKtPJItJnokEg7zObBaIA9dSTXuTF2f9m243Qxn7rN m7MARAAWnz0W5GHBEM11fdBVWtDPgTOY/iGN/k7E= 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.12 108/204] batman-adv: prevent ELP transmission interval underflow Date: Thu, 2 Jul 2026 18:19:25 +0200 Message-ID: <20260702155120.924545135@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155118.667618796@linuxfoundation.org> References: <20260702155118.667618796@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.12-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 9362cd9d6f3d33..a7522015224a5b 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -936,9 +936,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