Skip to content

Commit

Permalink
batman-adv: Fix parameter order of hlist_add_behind
Browse files Browse the repository at this point in the history
1d02328 ("list: fix order of arguments for
hlist_add_after(_rcu)") was incorrectly rebased on top of
d912426 ("batman-adv: Fix out-of-order
fragmentation support"). The parameter order change of the rebased patch was
not re-applied as expected. This causes a memory leak and can cause crashes
when out-of-order packets are received. hlist_add_behind will try to access the
uninitalized list pointers of frag_entry_new to find the previous/next entry
and may modify/read random memory locations.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sven Eckelmann authored and David S. Miller committed Aug 17, 2014
1 parent ed607b8 commit e050dbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/batman-adv/fragmentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,

/* 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);
hlist_add_behind(&frag_entry_new->list, &frag_entry_last->list);
chain->size += skb->len - hdr_size;
chain->timestamp = jiffies;
ret = true;
Expand Down

0 comments on commit e050dbe

Please sign in to comment.