linux/net/batman-adv
Sven Eckelmann 1ae7e76c61 batman-adv: Fix out-of-order fragmentation support
[ Upstream commit d9124268d8 ]

batadv_frag_insert_packet was unable to handle out-of-order packets because it
dropped them directly. This is caused by the way the fragmentation lists is
checked for the correct place to insert a fragmentation entry.

The fragmentation code keeps the fragments in lists. The fragmentation entries
are kept in descending order of sequence number. The list is traversed and each
entry is compared with the new fragment. If the current entry has a smaller
sequence number than the new fragment then the new one has to be inserted
before the current entry. This ensures that the list is still in descending
order.

An out-of-order packet with a smaller sequence number than all entries in the
list still has to be added to the end of the list. The used hlist has no
information about the last entry in the list inside hlist_head and thus the
last entry has to be calculated differently. Currently the code assumes that
the iterator variable of hlist_for_each_entry can be used for this purpose
after the hlist_for_each_entry finished. This is obviously wrong because the
iterator variable is always NULL when the list was completely traversed.

Instead the information about the last entry has to be stored in a different
variable.

This problem was introduced in 610bfc6bc9
("batman-adv: Receive fragmented packets and merge").

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-14 09:38:24 +08:00
..
bat_algo.h
bat_iv_ogm.c batman-adv: fix neigh_ifinfo imbalance 2014-05-31 13:20:37 -07:00
bitarray.c
bitarray.h
bridge_loop_avoidance.c
bridge_loop_avoidance.h
debugfs.c
debugfs.h
distributed-arp-table.c batman-adv: fix local TT check for outgoing arp requests in DAT 2014-05-31 13:20:39 -07:00
distributed-arp-table.h
fragmentation.c batman-adv: Fix out-of-order fragmentation support 2014-08-14 09:38:24 +08:00
fragmentation.h
gateway_client.c batman-adv: increase orig refcount when storing ref in gw_node 2014-05-31 13:20:39 -07:00
gateway_client.h
gateway_common.c
gateway_common.h
hard-interface.c batman-adv: fix soft-interface MTU computation 2014-02-17 17:17:00 +01:00
hard-interface.h
hash.c
hash.h
icmp_socket.c
icmp_socket.h
Kconfig
main.c
main.h
Makefile
network-coding.c
network-coding.h
originator.c batman-adv: fix indirect hard_iface NULL dereference 2014-05-31 13:20:38 -07:00
originator.h batman-adv: avoid potential race condition when adding a new neighbour 2014-02-17 17:17:01 +01:00
packet.h
routing.c batman-adv: free skb on TVLV parsing success 2014-02-17 17:17:02 +01:00
routing.h
send.c batman-adv: fix potential kernel paging error for unicast transmissions 2014-02-17 17:17:02 +01:00
send.h
soft-interface.c
soft-interface.h
sysfs.c
sysfs.h
translation-table.c batman-adv: fix TT CRC computation by ensuring byte order 2014-02-17 17:17:02 +01:00
translation-table.h
types.h