]> asedeno.scripts.mit.edu Git - linux.git/commit
batman-adv: Only read OGM2 tvlv_len after buffer len check
authorSven Eckelmann <sven@narfation.org>
Thu, 22 Aug 2019 06:55:36 +0000 (08:55 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Fri, 23 Aug 2019 16:20:31 +0000 (18:20 +0200)
commit0ff0f15a32c093381ad1abc06abe85afb561ab28
tree922d1d158866b0c7ab695628ad8a64a8e59be3c3
parenta15d56a60760aa9dbe26343b9a0ac5228f35d445
batman-adv: Only read OGM2 tvlv_len after buffer len check

Multiple batadv_ogm2_packet can be stored in an skbuff. The functions
batadv_v_ogm_send_to_if() uses batadv_v_ogm_aggr_packet() to check if there
is another additional batadv_ogm2_packet in the skb or not before they
continue processing the packet.

The length for such an OGM2 is BATADV_OGM2_HLEN +
batadv_ogm2_packet->tvlv_len. The check must first check that at least
BATADV_OGM2_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: 9323158ef9f4 ("batman-adv: OGMv2 - implement originators logic")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/bat_v_ogm.c