Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>, stable@vger.kernel.org
Subject: Re: [PATCH 5.10 10/23] batman-adv: prevent ELP transmission interval underflow
Date: Sat, 27 Jun 2026 14:05:39 +0200	[thread overview]
Message-ID: <2307937.irdbgypaU6@sven-desktop> (raw)
In-Reply-To: <stable-reply-item015-batman-adv-elp-p10-20260627@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

Hi Sasha,

On Saturday, 27 June 2026 13:26:17 CEST Sasha Levin wrote:
> > @@ -939,7 +939,13 @@ 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));
> >  	}
> 
> The backport computes the clamped elp_interval but then stores the raw
> nla_get_u32(attr) again, so the min_t()/max_t() clamping is dead code and
> the underflow this patch is meant to prevent is still reachable. The store
> should use the clamped local, matching the sibling orig_interval block just
> above it in the same function:
> 
> 		atomic_set(&hard_iface->bat_v.elp_interval, elp_interval);

You are correct. I copied basically this backporting error from 7.1 up until 
5.10. This makes this specific patch invalid in each patch series from yesterday.

Correct one (as you already wrote) should have looked like this in each stable 
kernel version:

--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -939,9 +939,15 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb,
 #ifdef CONFIG_BATMAN_ADV_BATMAN_V
 
 	if (info->attrs[BATADV_ATTR_ELP_INTERVAL]) {
-		attr = info->attrs[BATADV_ATTR_ELP_INTERVAL];
+		u32 elp_interval;
 
-		atomic_set(&hard_iface->bat_v.elp_interval, nla_get_u32(attr));
+		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, elp_interval);
 	}
 
 	if (info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE]) {

Do you just want to drop this from each patchset and we deal separately with 
it? Or do you propose a different approach?


Btw. If anyone wants to do range-diffs of these patchsets against the upstream 
patches:

git checkout -B reference 1e2fa2b10c234578d3c98c70f89c04a7aba4db92
git cherry-pick df97a7107b16375a10a36d7a63e9b4291a8ac680~1..edb557b2ba38fea2c5eb710cf366c797e187218c

# here just my own batadv/lts/7.1 branch:
git range-diff stable/linux-7.1.y..batadv/lts/7.1 3bd64ca11d9a1672d67d3130a7264c2cf7f93cdf..reference

Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-06-27 12:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 16:09 [PATCH 5.10 00/23] batman-adv: 7.2 merge window fixes backports Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 01/23] batman-adv: tp_meter: keep unacked list in ascending ordered Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 02/23] batman-adv: tp_meter: initialize dup_acks explicitly Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 03/23] batman-adv: tp_meter: initialize dec_cwnd explicitly Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 04/23] batman-adv: tp_meter: avoid window underflow Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 05/23] batman-adv: tp_meter: avoid divide-by-zero for dec_cwnd Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 06/23] batman-adv: tp_meter: fix fast recovery precondition Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 07/23] batman-adv: tp_meter: handle seqno wrap-around for fast recovery detection Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 08/23] batman-adv: tp_meter: add only finished tp_vars to lists Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 09/23] batman-adv: bla: annotate lasttime access with READ/WRITE_ONCE Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 10/23] batman-adv: prevent ELP transmission interval underflow Sven Eckelmann
2026-06-27 11:26   ` Sasha Levin
2026-06-27 12:05     ` Sven Eckelmann [this message]
2026-06-26 16:09 ` [PATCH 5.10 11/23] batman-adv: tp_meter: initialize last_recv_time during init Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 12/23] batman-adv: frag: ensure fragment is writable before modifying TTL Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 13/23] batman-adv: frag: avoid underflow of TTL Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 14/23] batman-adv: v: prevent OGM aggregation on disabled hardif Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 15/23] batman-adv: tp_meter: restrict number of unacked list entries Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 16/23] batman-adv: tp_meter: annotate last_recv_time access with READ/WRITE_ONCE Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 17/23] batman-adv: tp_meter: prevent parallel modifications of last_recv Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 18/23] batman-adv: tp_meter: handle overlapping packets Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 19/23] batman-adv: tt: don't merge change entries with different VIDs Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 20/23] batman-adv: tt: track roam count per VID Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 21/23] batman-adv: dat: prevent false sharing between VLANs Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 22/23] batman-adv: tvlv: enforce 2-byte alignment Sven Eckelmann
2026-06-26 16:09 ` [PATCH 5.10 23/23] batman-adv: tvlv: avoid race of cifsnotfound handler state Sven Eckelmann
2026-06-28  3:33 ` [PATCH 5.10 00/23] batman-adv: 7.2 merge window fixes backports Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2307937.irdbgypaU6@sven-desktop \
    --to=sven@narfation.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox