B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	b.a.t.m.a.n@lists.open-mesh.org,
	Sven Eckelmann <sven@narfation.org>,
	stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX
Date: Wed,  8 Jul 2026 11:18:13 +0200	[thread overview]
Message-ID: <20260708091821.314516-2-sw@simonwunderlich.de> (raw)
In-Reply-To: <20260708091821.314516-1-sw@simonwunderlich.de>

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


  reply	other threads:[~2026-07-08  9:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-07-09  9:20   ` [PATCH net 1/9] batman-adv: ensure minimal ethernet header on TX 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

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=20260708091821.314516-2-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sven@narfation.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