Re: [B.A.T.M.A.N.] [RFC] batman-adv: Calculate extra tail size based on queued fragments

Sven Eckelmann
2014-12-01T09:23:02Z

[-- Attachment #1: Type: text/plain, Size: 1845 bytes --]

On Monday 01 December 2014 00:05:20 Sven Eckelmann wrote:
> The fragmentation code was replaced in
> 9b3eab61754d74a93c9840c296013fe3b4a1b606 ("batman-adv: Receive fragmented
> packets and merge"). The new code provided a mostly unused parameter skb
> for the merging function. It is used inside the function to calculate the
> additionally needed skb tailroom. But instead of increasing its own
> tailroom, it is only increasing the tailroom of the first queued skb. This
> is not correct in most situations because the first queued entry can be a
> different one than the parameter.
>
> An observed problem was:
>
> 1. packet with size 104, total_size 1464, fragno 1 was received
> - packet is queued
> 2. packet with size 1400, total_size 1464, fragno 0 was received
> - packet is queued at the end of the list
> 3. enough data was received and can be given to the merge function
> (1464 == (1400 - 20) + (104 - 20))
> - merge functions gets 1400 byte large packet as skb argument
> 4. merge function gets first entry in queue (104 byte)
> - stored as skb_out
> 5. merge function calculates the required extra tail as total_size -
> skb->len - pskb_expand_head tail of skb_out with 64 bytes
> 6. merge function tries to squeeze the extra 1380 bytes from the second
> queued skb (1400 byte aka skb parameter) in the 64 extra tail bytes of
> skb_out
>
> Instead take only skbs from the queue to merge a packet and remove the
> problematic parameter.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Reported-by: Philipp Psurek <philipp.psurek@gmail.com>
> ---

I thought a little bit about it and this RFC is too big for inclusion into the
stable kernels. I would therefore propose to use the RFC-mini instead for
maint and send the remaining changes as extra patches for master. Any
comments?

Kind regards,
Sven

[-- Attachment #2: This is a digitally signed message part. --]