linux-stable/net/l2tp
Tom Parkin c1d3a84a67 l2tp: pass correct message length to ip6_append_data
commit 359e54a93a upstream.

l2tp_ip6_sendmsg needs to avoid accounting for the transport header
twice when splicing more data into an already partially-occupied skbuff.

To manage this, we check whether the skbuff contains data using
skb_queue_empty when deciding how much data to append using
ip6_append_data.

However, the code which performed the calculation was incorrect:

     ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;

...due to C operator precedence, this ends up setting ulen to
transhdrlen for messages with a non-zero length, which results in
corrupted packets on the wire.

Add parentheses to correct the calculation in line with the original
intent.

Fixes: 9d4c75800f ("ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data()")
Cc: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240220122156.43131-1-tparkin@katalix.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-01 13:13:36 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
l2tp_core.c l2tp: Don't sleep and disable BH under writer-side sk_callback_lock 2023-02-06 07:52:38 +01:00
l2tp_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
l2tp_debugfs.c l2tp: no need to check return value of debugfs_create functions 2019-06-14 08:45:05 -07:00
l2tp_eth.c net: core: add generic lockdep keys 2019-10-24 14:53:48 -07:00
l2tp_ip.c l2tp: do not use inet_hash()/inet_unhash() 2020-06-10 20:24:54 +02:00
l2tp_ip6.c l2tp: pass correct message length to ip6_append_data 2024-03-01 13:13:36 +01:00
l2tp_netlink.c l2tp: Allow management of tunnels and session in user namespace 2020-04-21 09:04:44 +02:00
l2tp_ppp.c compat_ioctl: pppoe: fix PPPOEIOCSFWD handling 2019-07-30 14:42:13 -07:00
Makefile