summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2016-07-02 03:52:13 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-07-05 06:40:01 -0400
commit10c78f5854d361ded4736c1831948e0a5f67b932 (patch)
treeab2abbe8074f82ec9de01105ce58514aa06cb7c1 /net/batman-adv
parent5b4d10f5e0369ed79434593b7cd8e85eebbe473f (diff)
batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
vlan_insert_tag can return NULL on errors. The bridge loop avoidance code therefore has to check the return value of vlan_insert_tag for NULL before it can safely operate on this pointer. Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code") Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 748a9ead7ce5..712978024c5d 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -418,9 +418,12 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
418 break; 418 break;
419 } 419 }
420 420
421 if (vid & BATADV_VLAN_HAS_TAG) 421 if (vid & BATADV_VLAN_HAS_TAG) {
422 skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), 422 skb = vlan_insert_tag(skb, htons(ETH_P_8021Q),
423 vid & VLAN_VID_MASK); 423 vid & VLAN_VID_MASK);
424 if (!skb)
425 goto out;
426 }
424 427
425 skb_reset_mac_header(skb); 428 skb_reset_mac_header(skb);
426 skb->protocol = eth_type_trans(skb, soft_iface); 429 skb->protocol = eth_type_trans(skb, soft_iface);