| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | | -/* Copyright (C) 2013-2018 B.A.T.M.A.N. contributors: |
|---|
| 2 | +/* Copyright (C) 2013-2020 B.A.T.M.A.N. contributors: |
|---|
| 3 | 3 | * |
|---|
| 4 | 4 | * Martin Hundebøll <martin@hundeboll.net> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of version 2 of the GNU General Public |
|---|
| 8 | | - * License as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 11 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 13 | | - * General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | 5 | */ |
|---|
| 18 | 6 | |
|---|
| 19 | 7 | #include "fragmentation.h" |
|---|
| .. | .. |
|---|
| 114 | 102 | * |
|---|
| 115 | 103 | * Caller must hold chain->lock. |
|---|
| 116 | 104 | * |
|---|
| 117 | | - * Return: true if chain is empty and caller can just insert the new fragment |
|---|
| 118 | | - * without searching for the right position. |
|---|
| 105 | + * Return: true if chain is empty and the caller can just insert the new |
|---|
| 106 | + * fragment without searching for the right position. |
|---|
| 119 | 107 | */ |
|---|
| 120 | 108 | static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, |
|---|
| 121 | 109 | u16 seqno) |
|---|
| .. | .. |
|---|
| 318 | 306 | * set *skb to merged packet; 2) Packet is buffered: Return true and set *skb |
|---|
| 319 | 307 | * to NULL; 3) Error: Return false and free skb. |
|---|
| 320 | 308 | * |
|---|
| 321 | | - * Return: true when packet is merged or buffered, false when skb is not not |
|---|
| 309 | + * Return: true when the packet is merged or buffered, false when skb is not |
|---|
| 322 | 310 | * used. |
|---|
| 323 | 311 | */ |
|---|
| 324 | 312 | bool batadv_frag_skb_buffer(struct sk_buff **skb, |
|---|
| .. | .. |
|---|
| 490 | 478 | goto free_skb; |
|---|
| 491 | 479 | } |
|---|
| 492 | 480 | |
|---|
| 481 | + /* GRO might have added fragments to the fragment list instead of |
|---|
| 482 | + * frags[]. But this is not handled by skb_split and must be |
|---|
| 483 | + * linearized to avoid incorrect length information after all |
|---|
| 484 | + * batman-adv fragments were created and submitted to the |
|---|
| 485 | + * hard-interface |
|---|
| 486 | + */ |
|---|
| 487 | + if (skb_has_frag_list(skb) && __skb_linearize(skb)) { |
|---|
| 488 | + ret = -ENOMEM; |
|---|
| 489 | + goto free_skb; |
|---|
| 490 | + } |
|---|
| 491 | + |
|---|
| 493 | 492 | /* Create one header to be copied to all fragments */ |
|---|
| 494 | 493 | frag_header.packet_type = BATADV_UNICAST_FRAG; |
|---|
| 495 | 494 | frag_header.version = BATADV_COMPAT_VERSION; |
|---|