b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] pull request for net: batman-adv 2022-05-08
@ 2022-05-08 13:21 Simon Wunderlich
  2022-05-08 13:21 ` [PATCH 1/1] batman-adv: Don't skb_split skbuffs with frag_list Simon Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wunderlich @ 2022-05-08 13:21 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, b.a.t.m.a.n

Hi David, hi Jakub,

here is a bugfix for batman-adv which we would like to have integrated into net.

Please pull or let me know of any problem!

Thank you,
      Simon

The following changes since commit 3123109284176b1532874591f7c81f3837bbdc17:

  Linux 5.18-rc1 (2022-04-03 14:08:21 -0700)

are available in the Git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batadv-net-pullrequest-20220508

for you to fetch changes up to a063f2fba3fa633a599253b62561051ac185fa99:

  batman-adv: Don't skb_split skbuffs with frag_list (2022-04-17 23:41:44 +0200)

----------------------------------------------------------------
Here is a batman-adv bugfix:

 - Don't skb_split skbuffs with frag_list, by Sven Eckelmann

----------------------------------------------------------------
Sven Eckelmann (1):
      batman-adv: Don't skb_split skbuffs with frag_list

 net/batman-adv/fragmentation.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] batman-adv: Don't skb_split skbuffs with frag_list
  2022-05-08 13:21 [PATCH 0/1] pull request for net: batman-adv 2022-05-08 Simon Wunderlich
@ 2022-05-08 13:21 ` Simon Wunderlich
  2022-05-10  1:20   ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wunderlich @ 2022-05-08 13:21 UTC (permalink / raw)
  To: davem, kuba
  Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Felix Kaechele, Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

The receiving interface might have used GRO to receive more fragments than
MAX_SKB_FRAGS fragments. In this case, these will not be stored in
skb_shinfo(skb)->frags but merged into the frag list.

batman-adv relies on the function skb_split to split packets up into
multiple smaller packets which are not larger than the MTU on the outgoing
interface. But this function cannot handle frag_list entries and is only
operating on skb_shinfo(skb)->frags. If it is still trying to split such an
skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST,
then validate_xmit_skb() will try to linearize it. But this fails due to
inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after
skb_copy_bits() returns an error.

In case of entries in frag_list, just linearize the skb before operating on
it with skb_split().

Reported-by: Felix Kaechele <felix@kaechele.ca>
Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Tested-by: Felix Kaechele <felix@kaechele.ca>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/fragmentation.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 0899a729a23f..c120c7c6d25f 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -475,6 +475,17 @@ int batadv_frag_send_packet(struct sk_buff *skb,
 		goto free_skb;
 	}
 
+	/* GRO might have added fragments to the fragment list instead of
+	 * frags[]. But this is not handled by skb_split and must be
+	 * linearized to avoid incorrect length information after all
+	 * batman-adv fragments were created and submitted to the
+	 * hard-interface
+	 */
+	if (skb_has_frag_list(skb) && __skb_linearize(skb)) {
+		ret = -ENOMEM;
+		goto free_skb;
+	}
+
 	/* Create one header to be copied to all fragments */
 	frag_header.packet_type = BATADV_UNICAST_FRAG;
 	frag_header.version = BATADV_COMPAT_VERSION;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] batman-adv: Don't skb_split skbuffs with frag_list
  2022-05-08 13:21 ` [PATCH 1/1] batman-adv: Don't skb_split skbuffs with frag_list Simon Wunderlich
@ 2022-05-10  1:20   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-10  1:20 UTC (permalink / raw)
  To: Simon Wunderlich; +Cc: davem, kuba, netdev, b.a.t.m.a.n, sven, felix

Hello:

This patch was applied to netdev/net.git (master)
by Simon Wunderlich <sw@simonwunderlich.de>:

On Sun,  8 May 2022 15:21:10 +0200 you wrote:
> From: Sven Eckelmann <sven@narfation.org>
> 
> The receiving interface might have used GRO to receive more fragments than
> MAX_SKB_FRAGS fragments. In this case, these will not be stored in
> skb_shinfo(skb)->frags but merged into the frag list.
> 
> batman-adv relies on the function skb_split to split packets up into
> multiple smaller packets which are not larger than the MTU on the outgoing
> interface. But this function cannot handle frag_list entries and is only
> operating on skb_shinfo(skb)->frags. If it is still trying to split such an
> skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST,
> then validate_xmit_skb() will try to linearize it. But this fails due to
> inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after
> skb_copy_bits() returns an error.
> 
> [...]

Here is the summary with links:
  - [1/1] batman-adv: Don't skb_split skbuffs with frag_list
    https://git.kernel.org/netdev/net/c/a063f2fba3fa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-10  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08 13:21 [PATCH 0/1] pull request for net: batman-adv 2022-05-08 Simon Wunderlich
2022-05-08 13:21 ` [PATCH 1/1] batman-adv: Don't skb_split skbuffs with frag_list Simon Wunderlich
2022-05-10  1:20   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).