Commit 50fa3b31 authored by Linus Lüssing's avatar Linus Lüssing Committed by Antonio Quartulli

batman-adv: check return type of unicast packet preparations

batadv_unicast(_4addr)_prepare_skb  might reallocate the skb's data.
And if it tries to do so then this can potentially fail.

We shouldn't continue working on this skb in such a case.
Signed-off-by: default avatarLinus Lüssing <linus.luessing@web.de>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Acked-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent 0f7dd1aa
...@@ -432,12 +432,16 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv, ...@@ -432,12 +432,16 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv,
switch (packet_type) { switch (packet_type) {
case BATADV_UNICAST: case BATADV_UNICAST:
batadv_unicast_prepare_skb(skb, orig_node); if (!batadv_unicast_prepare_skb(skb, orig_node))
goto out;
header_len = sizeof(struct batadv_unicast_packet); header_len = sizeof(struct batadv_unicast_packet);
break; break;
case BATADV_UNICAST_4ADDR: case BATADV_UNICAST_4ADDR:
batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
packet_subtype); packet_subtype))
goto out;
header_len = sizeof(struct batadv_unicast_4addr_packet); header_len = sizeof(struct batadv_unicast_4addr_packet);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment