Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[deliverable/linux.git] / net / batman-adv / fragmentation.c
index f14e54a0569178e8b423b4921c4b610e4c63039c..52c43f9042209deaba0be22b549724ad28de1a77 100644 (file)
@@ -128,6 +128,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
 {
        struct batadv_frag_table_entry *chain;
        struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr;
+       struct batadv_frag_list_entry *frag_entry_last = NULL;
        struct batadv_frag_packet *frag_packet;
        uint8_t bucket;
        uint16_t seqno, hdr_size = sizeof(struct batadv_frag_packet);
@@ -180,11 +181,14 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
                        ret = true;
                        goto out;
                }
+
+               /* store current entry because it could be the last in list */
+               frag_entry_last = frag_entry_curr;
        }
 
-       /* Reached the end of the list, so insert after 'frag_entry_curr'. */
-       if (likely(frag_entry_curr)) {
-               hlist_add_after(&frag_entry_curr->list, &frag_entry_new->list);
+       /* Reached the end of the list, so insert after 'frag_entry_last'. */
+       if (likely(frag_entry_last)) {
+               hlist_add_behind(&frag_entry_last->list, &frag_entry_new->list);
                chain->size += skb->len - hdr_size;
                chain->timestamp = jiffies;
                ret = true;
This page took 0.025078 seconds and 5 git commands to generate.