Fix out-of-order fragments reception.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJT4IPwAAoJEJgn97Bh2u9e1VYP/3oZvI8BPNJaU6rv+KsACBPG
 A1JD6bx9x3msFUZmuZtjcAp6EPDQGsBfTnV8wq7NhtKds7xbK8X+G3rXAHoaeNiC
 awyWQ3shD0Ksi8Y0dIlXvRJK8xcaVF0X+G9yjtT5fokDSVraaPNntJEsX2r/5+Gw
 +wMnOe3AorZy2koBucmf8Q5xXqiAbMY4l2Fwx8HIzM70z04h9JwgQyf1Ji/uM/q4
 s30wB5Omd+HY4TAbsbHe/Or7inT6qhqwWbitS13VK6V7765Tb3WCg19hDtYYX09p
 ZlLvqolBgwb5Ey4ZV/VaZ5erLdZ12wEfBAxYjem7JnHUyLKqr9KdLiv8i4/cNaLS
 lvTCIPD/RTtLmzKni6NpYxQ7WeB7533+4I+dg1ZfqtTuRMrZdaPQ7ER/QeR4/kV4
 Ua88zJ9Zj9ffxsCKjyOf2Dw1dQtzfLJdvHBU5pJ9sC47RcLv0a+68dE2+kmbPdNY
 eLVxUAw1fMQhH4PyBRCJPncY79YLeM6eemMZhukc728/NfXVkfGXgNJlMpnD+dJE
 +yYSpYRd6/RjyXQUBhzDPyrsNNKiPP8flW/R11jdcSq8YSdPzvMWUHvXPTA/1d3C
 U9Qsf3aA+0wH4vtJ8G7klk8GmYxFZuYFNKwYVxVX9PQNzLCoVCNYENkPvjEz827C
 MGwkqrh44S/+5++12b9+
 =CJDS
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
David S. Miller 2014-08-05 16:20:16 -07:00
commit f2294eb59d
1 changed files with 7 additions and 3 deletions

View 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_table_entry *chain;
struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr; 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; struct batadv_frag_packet *frag_packet;
uint8_t bucket; uint8_t bucket;
uint16_t seqno, hdr_size = sizeof(struct batadv_frag_packet); 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; ret = true;
goto out; 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'. */ /* Reached the end of the list, so insert after 'frag_entry_last'. */
if (likely(frag_entry_curr)) { if (likely(frag_entry_last)) {
hlist_add_after(&frag_entry_curr->list, &frag_entry_new->list); hlist_add_after(&frag_entry_last->list, &frag_entry_new->list);
chain->size += skb->len - hdr_size; chain->size += skb->len - hdr_size;
chain->timestamp = jiffies; chain->timestamp = jiffies;
ret = true; ret = true;