aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller2014-08-05 16:20:16 -0700
committerDavid S. Miller2014-08-05 16:20:16 -0700
commitf2294eb59d5c3efa51acb3f42a7a382e9353bdc7 (patch)
treed7fde990c3b172d0f85d2d78e8662556d97c5c15
parent4f933f414bf629852f361edf0fc5e765e3e78388 (diff)
parentd9124268d84a836f14a6ead54ff9d8eee4c43be5 (diff)
Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge
Antonio Quartulli says: ==================== pull request net: batman-adv 2014-08-04 this is a pull request intended for net. It just contains a patch by Sven Eckelmann that fixes the reception of out-of-order fragments. As explained in the commit message, the issue was due to a wrong assumption about hlist_for_each_entry() in batadv_frag_insert_packet(). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/batman-adv/fragmentation.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index f14e54a05691..022d18ab27a6 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -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_after(&frag_entry_last->list, &frag_entry_new->list);
chain->size += skb->len - hdr_size;
chain->timestamp = jiffies;
ret = true;