]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/batman-adv/bat_iv_ogm.c
Merge tag 'kbuild-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[karo-tx-linux.git] / net / batman-adv / bat_iv_ogm.c
index 71343d0fec94b55f7318ec8578abc956148f7791..495ba7cdcb0451c997656116a300a49b7e43a089 100644 (file)
@@ -679,15 +679,11 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 {
        struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
        struct batadv_forw_packet *forw_packet_aggr;
+       struct sk_buff *skb;
        unsigned char *skb_buff;
        unsigned int skb_size;
        atomic_t *queue_left = own_packet ? NULL : &bat_priv->batman_queue_left;
 
-       forw_packet_aggr = batadv_forw_packet_alloc(if_incoming, if_outgoing,
-                                                   queue_left, bat_priv);
-       if (!forw_packet_aggr)
-               return;
-
        if (atomic_read(&bat_priv->aggregated_ogms) &&
            packet_len < BATADV_MAX_AGGREGATION_BYTES)
                skb_size = BATADV_MAX_AGGREGATION_BYTES;
@@ -696,9 +692,14 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 
        skb_size += ETH_HLEN;
 
-       forw_packet_aggr->skb = netdev_alloc_skb_ip_align(NULL, skb_size);
-       if (!forw_packet_aggr->skb) {
-               batadv_forw_packet_free(forw_packet_aggr, true);
+       skb = netdev_alloc_skb_ip_align(NULL, skb_size);
+       if (!skb)
+               return;
+
+       forw_packet_aggr = batadv_forw_packet_alloc(if_incoming, if_outgoing,
+                                                   queue_left, bat_priv, skb);
+       if (!forw_packet_aggr) {
+               kfree_skb(skb);
                return;
        }