• Sven Eckelmann's avatar
    batman-adv: Only read OGM tvlv_len after buffer len check · a15d56a6
    Sven Eckelmann authored
    Multiple batadv_ogm_packet can be stored in an skbuff. The functions
    batadv_iv_ogm_send_to_if()/batadv_iv_ogm_receive() use
    batadv_iv_ogm_aggr_packet() to check if there is another additional
    batadv_ogm_packet in the skb or not before they continue processing the
    packet.
    
    The length for such an OGM is BATADV_OGM_HLEN +
    batadv_ogm_packet->tvlv_len. The check must first check that at least
    BATADV_OGM_HLEN bytes are available before it accesses tvlv_len (which is
    part of the header. Otherwise it might try read outside of the currently
    available skbuff to get the content of tvlv_len.
    
    Fixes: ef261577 ("batman-adv: tvlv - basic infrastructure")
    Reported-by: syzbot+355cab184197dbbfa384@syzkaller.appspotmail.com
    Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
    Acked-by: default avatarAntonio Quartulli <a@unstable.cc>
    Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
    a15d56a6
bat_iv_ogm.c 78.6 KB