* [PATCH net 0/9] pull request: batman-adv 2026-07-08
@ 2026-07-08 9:18 Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX Simon Wunderlich
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Simon Wunderlich
Dear net maintainers,
here are some more smaller bugfixes for batman-adv which we would like
to have integrated into net.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 26560c4a03dc4d607331600c187f59ab2df5f341:
batman-adv: dat: ensure accessible eth_hdr proto field (2026-06-28 11:49:04 +0200)
are available in the Git repository at:
https://git.open-mesh.org/batadv.git tags/batadv-net-pullrequest-20260708
for you to fetch changes up to 98052bdaf6ac1639a63ffc10244eeeab1f62ed2b:
batman-adv: dat: fix tie-break for candidate selection (2026-07-06 07:18:59 +0200)
----------------------------------------------------------------
Here are some batman-adv bugfixes, all by Sven Eckelmann:
- ensure minimal ethernet header on TX
- fix VLAN priority offset
- clean untagged VLAN on netdev registration failure
- tt: avoid request storms during pending request
- tt: prevent TVLV OOB check overflow
- frag: free unfragmentable packet
- frag: fix primary_if leak on failed linearization
- mcast: avoid OOB read of num_dests header
- dat: fix tie-break for candidate selection
----------------------------------------------------------------
Sven Eckelmann (9):
batman-adv: ensure minimal ethernet header on TX
batman-adv: fix VLAN priority offset
batman-adv: clean untagged VLAN on netdev registration failure
batman-adv: tt: avoid request storms during pending request
batman-adv: tt: prevent TVLV OOB check overflow
batman-adv: frag: free unfragmentable packet
batman-adv: frag: fix primary_if leak on failed linearization
batman-adv: mcast: avoid OOB read of num_dests header
batman-adv: dat: fix tie-break for candidate selection
net/batman-adv/distributed-arp-table.c | 2 +-
net/batman-adv/fragmentation.c | 8 +++++---
net/batman-adv/main.c | 10 +++++++++-
net/batman-adv/mesh-interface.c | 16 +++++-----------
net/batman-adv/mesh-interface.h | 2 ++
net/batman-adv/multicast_forw.c | 7 +++----
net/batman-adv/translation-table.c | 5 +++--
7 files changed, 28 insertions(+), 22 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-09 9:20 ` patchwork-bot+netdevbpf
2026-07-08 9:18 ` [PATCH net 2/9] batman-adv: fix VLAN priority offset Simon Wunderlich
` (7 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable, Sashiko,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
As documented in commit 8bd67ebb50c0 ("net: bridge: xmit: make sure we have
at least eth header len bytes"), it is possible by for a local user with
eBPF TC hook access to attach a tc filter which truncates the packet and
redirects to an batadv interface. But the code assumes that at least
ETH_HLEN bytes are available and thus might read outside of the available
buffer.
The batadv_interface_tx() must therefore always check itself if enough data
is available for the ethernet header and don't rely on min_header_len.
Cc: stable@vger.kernel.org
Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/mesh-interface.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/batman-adv/mesh-interface.c b/net/batman-adv/mesh-interface.c
index 511f70e0706a7..0b75234521b63 100644
--- a/net/batman-adv/mesh-interface.c
+++ b/net/batman-adv/mesh-interface.c
@@ -195,6 +195,9 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb,
if (READ_ONCE(bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
goto dropped;
+ if (!pskb_may_pull(skb, ETH_HLEN))
+ goto dropped;
+
/* reset control block to avoid left overs from previous users */
memset(skb->cb, 0, sizeof(struct batadv_skb_cb));
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 2/9] batman-adv: fix VLAN priority offset
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 3/9] batman-adv: clean untagged VLAN on netdev registration failure Simon Wunderlich
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
The batadv_skb_set_priority() receives an SKB with the inner ethernet
header at position "offset". When it tries to extract the IPv4 and IPv6
header, it needs to skip the ethernet header to get access to the IP
header.
But for VLAN header, it performs the access with the struct vlan_ethhdr.
This struct contains both both the ethernet header and the VLAN header. It
is therefore incorrect to skip over the whole vlan_ethhdr size to get
access to the vlan_ethhdr.
Cc: stable@vger.kernel.org
Fixes: c54f38c9aa22 ("batman-adv: set skb priority according to content")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 4d3807a645b78..8844e40e6a803 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -368,7 +368,7 @@ void batadv_skb_set_priority(struct sk_buff *skb, int offset)
switch (ethhdr->h_proto) {
case htons(ETH_P_8021Q):
- vhdr = skb_header_pointer(skb, offset + sizeof(*vhdr),
+ vhdr = skb_header_pointer(skb, offset,
sizeof(*vhdr), &vhdr_tmp);
if (!vhdr)
return;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 3/9] batman-adv: clean untagged VLAN on netdev registration failure
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 2/9] batman-adv: fix VLAN priority offset Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 4/9] batman-adv: tt: avoid request storms during pending request Simon Wunderlich
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
When an mesh interface is registered, it creates an untagged struct
batadv_meshif_vlan on top of it via the NETDEV_REGISTER notifier. But in
this process, another receiver of this notification can veto the
registration. The netdev registration will be aborted because of this veto.
The register_netdevice() call will try to clean up the net_device using
unregister_netdevice_queue() - which only uses the .priv_destructor to
free private resources. In this situation, .dellink will not be called.
The cleanup of the untagged batadv_meshif_vlan must thefore be done in the
destructor to avoid a leak of this object.
Cc: stable@vger.kernel.org
Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/main.c | 8 ++++++++
net/batman-adv/mesh-interface.c | 13 ++-----------
net/batman-adv/mesh-interface.h | 2 ++
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 8844e40e6a803..67bed3ee77e7e 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -259,6 +259,7 @@ int batadv_mesh_init(struct net_device *mesh_iface)
void batadv_mesh_free(struct net_device *mesh_iface)
{
struct batadv_priv *bat_priv = netdev_priv(mesh_iface);
+ struct batadv_meshif_vlan *vlan;
WRITE_ONCE(bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
@@ -273,6 +274,13 @@ void batadv_mesh_free(struct net_device *mesh_iface)
batadv_mcast_free(bat_priv);
+ /* destroy the "untagged" VLAN */
+ vlan = batadv_meshif_vlan_get(bat_priv, BATADV_NO_FLAGS);
+ if (vlan) {
+ batadv_meshif_destroy_vlan(bat_priv, vlan);
+ batadv_meshif_vlan_put(vlan);
+ }
+
/* Free the TT and the originator tables only after having terminated
* all the other depending components which may use these structures for
* their purposes.
diff --git a/net/batman-adv/mesh-interface.c b/net/batman-adv/mesh-interface.c
index 0b75234521b63..fbfd99268de47 100644
--- a/net/batman-adv/mesh-interface.c
+++ b/net/batman-adv/mesh-interface.c
@@ -595,8 +595,8 @@ int batadv_meshif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid)
* @bat_priv: the bat priv with all the mesh interface information
* @vlan: the object to remove
*/
-static void batadv_meshif_destroy_vlan(struct batadv_priv *bat_priv,
- struct batadv_meshif_vlan *vlan)
+void batadv_meshif_destroy_vlan(struct batadv_priv *bat_priv,
+ struct batadv_meshif_vlan *vlan)
{
/* explicitly remove the associated TT local entry because it is marked
* with the NOPURGE flag
@@ -1091,22 +1091,13 @@ static int batadv_meshif_newlink(struct net_device *dev,
static void batadv_meshif_destroy_netlink(struct net_device *mesh_iface,
struct list_head *head)
{
- struct batadv_priv *bat_priv = netdev_priv(mesh_iface);
struct batadv_hard_iface *hard_iface;
- struct batadv_meshif_vlan *vlan;
while (!list_empty(&mesh_iface->adj_list.lower)) {
hard_iface = netdev_adjacent_get_private(mesh_iface->adj_list.lower.next);
batadv_hardif_disable_interface(hard_iface);
}
- /* destroy the "untagged" VLAN */
- vlan = batadv_meshif_vlan_get(bat_priv, BATADV_NO_FLAGS);
- if (vlan) {
- batadv_meshif_destroy_vlan(bat_priv, vlan);
- batadv_meshif_vlan_put(vlan);
- }
-
unregister_netdevice_queue(mesh_iface, head);
}
diff --git a/net/batman-adv/mesh-interface.h b/net/batman-adv/mesh-interface.h
index 53756c5a45e04..5e1e83e04ffbc 100644
--- a/net/batman-adv/mesh-interface.h
+++ b/net/batman-adv/mesh-interface.h
@@ -21,6 +21,8 @@ void batadv_interface_rx(struct net_device *mesh_iface,
bool batadv_meshif_is_valid(const struct net_device *net_dev);
extern struct rtnl_link_ops batadv_link_ops;
int batadv_meshif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid);
+void batadv_meshif_destroy_vlan(struct batadv_priv *bat_priv,
+ struct batadv_meshif_vlan *vlan);
void batadv_meshif_vlan_release(struct kref *ref);
struct batadv_meshif_vlan *batadv_meshif_vlan_get(struct batadv_priv *bat_priv,
unsigned short vid);
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 4/9] batman-adv: tt: avoid request storms during pending request
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (2 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 3/9] batman-adv: clean untagged VLAN on netdev registration failure Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 5/9] batman-adv: tt: prevent TVLV OOB check overflow Simon Wunderlich
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
batadv_send_tt_request() allocates a tt_req_node when none exists for the
destination originator node. This should prevent that a multiple TT
requests are send at the same time to an originator.
But if allocation of the send buffer failed, this request must be cleaned
up again. But indicator for such a failure is "ret == false". But the
actual implementation is checking for "ret == true".
The check must be inverted to not loose the information about the TT
request directly after it was attempted to be sent out. This should avoid
potential request storms.
Cc: stable@vger.kernel.org
Fixes: 335fbe0f5d25 ("batman-adv: tvlv - convert tt query packet to use tvlv unicast packets")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/translation-table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4bfad36a4b704..aae72015645a4 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2971,7 +2971,7 @@ static bool batadv_send_tt_request(struct batadv_priv *bat_priv,
out:
batadv_hardif_put(primary_if);
- if (ret && tt_req_node) {
+ if (!ret && tt_req_node) {
spin_lock_bh(&bat_priv->tt.req_list_lock);
if (!hlist_unhashed(&tt_req_node->list)) {
hlist_del_init(&tt_req_node->list);
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 5/9] batman-adv: tt: prevent TVLV OOB check overflow
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (3 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 4/9] batman-adv: tt: avoid request storms during pending request Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 6/9] batman-adv: frag: free unfragmentable packet Simon Wunderlich
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
A TT unicast TVLV contains the number of VLANs stored in it. This number is
an u16 and gets multiplied by the size of the struct
batadv_tvlv_tt_vlan_data (8 bytes). The size can therefore overflow the u16
used to store the tt_vlan_len. All additional safety checks to prevent
out-of-bounds access of the TVLV buffer are invalid due to this overflow.
Using size_t prevents this overflow and ensures that the safety checks
compare against the actual buffer requirements.
Cc: stable@vger.kernel.org
Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/translation-table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index aae72015645a4..dae5e1d8c0385 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -4033,7 +4033,8 @@ static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
u16 tvlv_value_len)
{
struct batadv_tvlv_tt_data *tt_data;
- u16 tt_vlan_len, tt_num_entries;
+ u16 tt_num_entries;
+ size_t tt_vlan_len;
char tt_flag;
bool ret;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 6/9] batman-adv: frag: free unfragmentable packet
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (4 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 5/9] batman-adv: tt: prevent TVLV OOB check overflow Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 7/9] batman-adv: frag: fix primary_if leak on failed linearization Simon Wunderlich
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
The caller of batadv_frag_send_packet() assume that the skb provided to the
function are always consumed. But the pre-check for an empty payload or the
zero fragment size returned an error without any further actions.
A failed pre-check must use the same error handling code as the rest of the
function.
Cc: stable@vger.kernel.org
Fixes: ee75ed88879a ("batman-adv: Fragment and send skbs larger than mtu")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/fragmentation.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 8a006a0473a87..13d4689d332dc 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -518,8 +518,10 @@ int batadv_frag_send_packet(struct sk_buff *skb,
mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
max_fragment_size = mtu - header_size;
- if (skb->len == 0 || max_fragment_size == 0)
- return -EINVAL;
+ if (skb->len == 0 || max_fragment_size == 0) {
+ ret = -EINVAL;
+ goto free_skb;
+ }
num_fragments = (skb->len - 1) / max_fragment_size + 1;
max_fragment_size = (skb->len - 1) / num_fragments + 1;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 7/9] batman-adv: frag: fix primary_if leak on failed linearization
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (5 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 6/9] batman-adv: frag: free unfragmentable packet Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 8/9] batman-adv: mcast: avoid OOB read of num_dests header Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 9/9] batman-adv: dat: fix tie-break for candidate selection Simon Wunderlich
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable, Sashiko,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
If the skb has a frag_list, it must be linearized before it can be split
using skb_split(). But when this step failed, it must not only free the skb
but also take care of the reference to the already found primary_if.
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: a063f2fba3fa ("batman-adv: Don't skb_split skbuffs with frag_list")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/fragmentation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 13d4689d332dc..2e20a2cb64cbf 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -547,7 +547,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
*/
if (skb_has_frag_list(skb) && __skb_linearize(skb)) {
ret = -ENOMEM;
- goto free_skb;
+ goto put_primary_if;
}
/* Create one header to be copied to all fragments */
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 8/9] batman-adv: mcast: avoid OOB read of num_dests header
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (6 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 7/9] batman-adv: frag: fix primary_if leak on failed linearization Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 9/9] batman-adv: dat: fix tie-break for candidate selection Simon Wunderlich
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
Before the access to struct batadv_tvlv_mcast_tracker's num_dests, it is
attempted to check whether enough space is actually in the network header.
But instead of using offsetofend() to check for the whole size (2) which
must be accessible, offsetof() of is called. The latter is always returning
0. The comparison with the network header length will always return that
enough data is available - even when only 1 or 0 bytes are accessible.
Instead of using offsetofend(), use the more common check for the whole
header.
Cc: stable@vger.kernel.org
Fixes: 07afe1ba288c ("batman-adv: mcast: implement multicast packet reception and forwarding")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/multicast_forw.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/batman-adv/multicast_forw.c b/net/batman-adv/multicast_forw.c
index b8668a80b94a1..1404a3b7adfb1 100644
--- a/net/batman-adv/multicast_forw.c
+++ b/net/batman-adv/multicast_forw.c
@@ -927,11 +927,11 @@ static int batadv_mcast_forw_packet(struct batadv_priv *bat_priv,
{
struct batadv_tvlv_mcast_tracker *mcast_tracker;
struct batadv_neigh_node *neigh_node;
- unsigned long offset, num_dests_off;
struct sk_buff *nexthop_skb;
unsigned char *skb_net_hdr;
bool local_recv = false;
unsigned int tvlv_len;
+ unsigned long offset;
bool xmitted = false;
u8 *dest, *next_dest;
u16 num_dests;
@@ -940,9 +940,8 @@ static int batadv_mcast_forw_packet(struct batadv_priv *bat_priv,
/* (at least) TVLV part needs to be linearized */
SKB_LINEAR_ASSERT(skb);
- /* check if num_dests is within skb length */
- num_dests_off = offsetof(struct batadv_tvlv_mcast_tracker, num_dests);
- if (num_dests_off > skb_network_header_len(skb))
+ /* check if batadv_tvlv_mcast_tracker header is within skb length */
+ if (sizeof(*mcast_tracker) > skb_network_header_len(skb))
return -EINVAL;
skb_net_hdr = skb_network_header(skb);
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 9/9] batman-adv: dat: fix tie-break for candidate selection
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
` (7 preceding siblings ...)
2026-07-08 9:18 ` [PATCH net 8/9] batman-adv: mcast: avoid OOB read of num_dests header Simon Wunderlich
@ 2026-07-08 9:18 ` Simon Wunderlich
8 siblings, 0 replies; 11+ messages in thread
From: Simon Wunderlich @ 2026-07-08 9:18 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, b.a.t.m.a.n, Sven Eckelmann, stable,
Simon Wunderlich
From: Sven Eckelmann <sven@narfation.org>
The original version of the candidate selection for DAT attempted to
compare both candidate and max_orig_node to identify which has the smaller
MAC address. This comparison is required as tie-break when a hash collision
happened.
But the used function returned 0 when the function was not equal and a
non-zero value when it was equal. As result, the actually selected
node was dependent on the order of entries in the orig_hash and not
actually on the mac addresses. The last originator in the hash collision
would always win.
To have a proper ordering, it must diff the actual MAC address bytes and
reject the candidate when the diff is not smaller than 0.
Cc: stable@vger.kernel.org
Fixes: 785ea1144182 ("batman-adv: Distributed ARP Table - create DHT helper functions")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/distributed-arp-table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index c40c9e02391be..a6fe4820f65b9 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -546,7 +546,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
* the one with the lowest address
*/
if (tmp_max == max && max_orig_node &&
- batadv_compare_eth(candidate->orig, max_orig_node->orig))
+ memcmp(candidate->orig, max_orig_node->orig, ETH_ALEN) >= 0)
goto out;
ret = true;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX
2026-07-08 9:18 ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX Simon Wunderlich
@ 2026-07-09 9:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-09 9:20 UTC (permalink / raw)
To: Simon Wunderlich
Cc: netdev, davem, edumazet, kuba, pabeni, horms, b.a.t.m.a.n, sven,
stable, sashiko-bot
Hello:
This series was applied to netdev/net.git (main)
by Sven Eckelmann <sven@narfation.org>:
On Wed, 8 Jul 2026 11:18:13 +0200 you wrote:
> From: Sven Eckelmann <sven@narfation.org>
>
> As documented in commit 8bd67ebb50c0 ("net: bridge: xmit: make sure we have
> at least eth header len bytes"), it is possible by for a local user with
> eBPF TC hook access to attach a tc filter which truncates the packet and
> redirects to an batadv interface. But the code assumes that at least
> ETH_HLEN bytes are available and thus might read outside of the available
> buffer.
>
> [...]
Here is the summary with links:
- [net,1/9] batman-adv: ensure minimal ethernet header on TX
https://git.kernel.org/netdev/net/c/49df66b7993c
- [net,2/9] batman-adv: fix VLAN priority offset
https://git.kernel.org/netdev/net/c/fdb3be00ba4d
- [net,3/9] batman-adv: clean untagged VLAN on netdev registration failure
https://git.kernel.org/netdev/net/c/8669a550c752
- [net,4/9] batman-adv: tt: avoid request storms during pending request
https://git.kernel.org/netdev/net/c/27c7d4000823
- [net,5/9] batman-adv: tt: prevent TVLV OOB check overflow
https://git.kernel.org/netdev/net/c/7a581d9aaba8
- [net,6/9] batman-adv: frag: free unfragmentable packet
https://git.kernel.org/netdev/net/c/6b628425aed4
- [net,7/9] batman-adv: frag: fix primary_if leak on failed linearization
https://git.kernel.org/netdev/net/c/353d2c1d5492
- [net,8/9] batman-adv: mcast: avoid OOB read of num_dests header
https://git.kernel.org/netdev/net/c/38eaed28e250
- [net,9/9] batman-adv: dat: fix tie-break for candidate selection
https://git.kernel.org/netdev/net/c/98052bdaf6ac
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-07-09 9:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 9:18 [PATCH net 0/9] pull request: batman-adv 2026-07-08 Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX Simon Wunderlich
2026-07-09 9:20 ` patchwork-bot+netdevbpf
2026-07-08 9:18 ` [PATCH net 2/9] batman-adv: fix VLAN priority offset Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 3/9] batman-adv: clean untagged VLAN on netdev registration failure Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 4/9] batman-adv: tt: avoid request storms during pending request Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 5/9] batman-adv: tt: prevent TVLV OOB check overflow Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 6/9] batman-adv: frag: free unfragmentable packet Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 7/9] batman-adv: frag: fix primary_if leak on failed linearization Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 8/9] batman-adv: mcast: avoid OOB read of num_dests header Simon Wunderlich
2026-07-08 9:18 ` [PATCH net 9/9] batman-adv: dat: fix tie-break for candidate selection Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox