hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/net/batman-adv/fragmentation.c
....@@ -1,19 +1,7 @@
11 // 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:
33 *
44 * 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/>.
175 */
186
197 #include "fragmentation.h"
....@@ -114,8 +102,8 @@
114102 *
115103 * Caller must hold chain->lock.
116104 *
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.
119107 */
120108 static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
121109 u16 seqno)
....@@ -318,7 +306,7 @@
318306 * set *skb to merged packet; 2) Packet is buffered: Return true and set *skb
319307 * to NULL; 3) Error: Return false and free skb.
320308 *
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
322310 * used.
323311 */
324312 bool batadv_frag_skb_buffer(struct sk_buff **skb,
....@@ -490,6 +478,17 @@
490478 goto free_skb;
491479 }
492480
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
+
493492 /* Create one header to be copied to all fragments */
494493 frag_header.packet_type = BATADV_UNICAST_FRAG;
495494 frag_header.version = BATADV_COMPAT_VERSION;