aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index f961cc5eade5..ef24a7205f65 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -39,7 +39,7 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
39 struct hlist_head *head; 39 struct hlist_head *head;
40 struct orig_node *orig_node; 40 struct orig_node *orig_node;
41 unsigned long *word; 41 unsigned long *word;
42 int i; 42 uint32_t i;
43 size_t word_index; 43 size_t word_index;
44 44
45 for (i = 0; i < hash->size; i++) { 45 for (i = 0; i < hash->size; i++) {
@@ -578,6 +578,7 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
578{ 578{
579 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); 579 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
580 struct tt_query_packet *tt_query; 580 struct tt_query_packet *tt_query;
581 uint16_t tt_len;
581 struct ethhdr *ethhdr; 582 struct ethhdr *ethhdr;
582 583
583 /* drop packet if it has not necessary minimum size */ 584 /* drop packet if it has not necessary minimum size */
@@ -616,13 +617,22 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
616 } 617 }
617 break; 618 break;
618 case TT_RESPONSE: 619 case TT_RESPONSE:
619 /* packet needs to be linearized to access the TT changes */ 620 if (is_my_mac(tt_query->dst)) {
620 if (skb_linearize(skb) < 0) 621 /* packet needs to be linearized to access the TT
621 goto out; 622 * changes */
623 if (skb_linearize(skb) < 0)
624 goto out;
625
626 tt_len = tt_query->tt_data * sizeof(struct tt_change);
627
628 /* Ensure we have all the claimed data */
629 if (unlikely(skb_headlen(skb) <
630 sizeof(struct tt_query_packet) +
631 tt_len))
632 goto out;
622 633
623 if (is_my_mac(tt_query->dst))
624 handle_tt_response(bat_priv, tt_query); 634 handle_tt_response(bat_priv, tt_query);
625 else { 635 } else {
626 bat_dbg(DBG_TT, bat_priv, 636 bat_dbg(DBG_TT, bat_priv,
627 "Routing TT_RESPONSE to %pM [%c]\n", 637 "Routing TT_RESPONSE to %pM [%c]\n",
628 tt_query->dst, 638 tt_query->dst,