The following commit has been merged in the master branch:
commit 0d4aef630be9d5f9c1227d07669c26c4383b5ad0
Author: Yang Yang <[email protected]>
Date:   Sat Mar 14 07:11:27 2026 +0000

    batman-adv: avoid OGM aggregation when skb tailroom is insufficient
    
    When OGM aggregation state is toggled at runtime, an existing forwarded
    packet may have been allocated with only packet_len bytes, while a later
    packet can still be selected for aggregation. Appending in this case can
    hit skb_put overflow conditions.
    
    Reject aggregation when the target skb tailroom cannot accommodate the new
    packet. The caller then falls back to creating a new forward packet
    instead of appending.
    
    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Cc: [email protected]
    Reported-by: Yifan Wu <[email protected]>
    Reported-by: Juefei Pu <[email protected]>
    Signed-off-by: Yuan Tan <[email protected]>
    Signed-off-by: Xin Liu <[email protected]>
    Signed-off-by: Ao Zhou <[email protected]>
    Signed-off-by: Yang Yang <[email protected]>
    Signed-off-by: Sven Eckelmann <[email protected]>
    Signed-off-by: Simon Wunderlich <[email protected]>

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index b75c2228e69a6..f28e9cbf8ad5f 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -473,6 +473,9 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet 
*new_bat_ogm_packet,
        if (aggregated_bytes > max_bytes)
                return false;
 
+       if (skb_tailroom(forw_packet->skb) < packet_len)
+               return false;
+
        if (packet_num >= BATADV_MAX_AGGREGATION_PACKETS)
                return false;
 

-- 
LinuxNextTracking

Reply via email to