diff options
| author | Zhiling Zou <zhilinz@nebusec.ai> | 2026-07-31 11:18:49 +0800 |
|---|---|---|
| committer | Sven Eckelmann <sven@narfation.org> | 2026-08-05 10:04:35 +0200 |
| commit | ad46c907d7d9975a285c1e89a4adde652eaa93f5 (patch) | |
| tree | a4ce45863ecb3d17b6842b02b1ff1e2a217297f6 | |
| parent | 02aee8ebea3a714d92b27da9a9d8791d8c8c9a4f (diff) | |
| download | linux-ad46c907d7d9975a285c1e89a4adde652eaa93f5.tar.gz linux-ad46c907d7d9975a285c1e89a4adde652eaa93f5.zip | |
batman-adv: fix stale receive device on merged fragments
Fragment reassembly reuses the skb from the highest-numbered buffered
fragment as the merged packet. When that fragment was received on a hard
interface which is deleted before the chain completes, the merged skb can
re-enter the receive path with a stale skb->dev and skb_iif.
batadv_batman_skb_recv() passes such merged packets through the normal
receive handlers again. DAT and bridge loop avoidance both derive the ARP
header length from skb->dev, so they can dereference the freed net_device
before the packet reaches the local mesh interface.
Refresh the receive device metadata from the current receive device before
running the packet handlers. This keeps internally reinjected merged
fragments consistent with the normal receive path after hard interface
teardown.
Fixes: 610bfc6bc99b ("batman-adv: Receive fragmented packets and merge")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
| -rw-r--r-- | net/batman-adv/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 77597171d637..d89d44706269 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -492,6 +492,10 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, if (!skb) goto err_put; + /* Merged fragments re-enter here with reused skb metadata. */ + skb->dev = dev; + skb->skb_iif = dev->ifindex; + /* packet should hold at least type and version */ if (unlikely(!pskb_may_pull(skb, 2))) goto err_free; |
