Skip to content

Commit

Permalink
batman-adv: check return type of unicast packet preparations
Browse files Browse the repository at this point in the history
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: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  • Loading branch information
Linus Lüssing authored and Antonio Quartulli committed Aug 17, 2013
1 parent 0f7dd1a commit 50fa3b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions net/batman-adv/unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,16 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv,

switch (packet_type) {
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);
break;
case BATADV_UNICAST_4ADDR:
batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
packet_subtype);
if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
packet_subtype))
goto out;

header_len = sizeof(struct batadv_unicast_4addr_packet);
break;
default:
Expand Down

0 comments on commit 50fa3b3

Please sign in to comment.