kernel_samsung_a53x/net/ipv4
Anton Danilov ae49cd62cc ipv4: ip_gre: Fix drops of small packets in ipgre_xmit
[ Upstream commit c4a14f6d9d17ad1e41a36182dd3b8a5fd91efbd7 ]

Regression Description:

Depending on the options specified for the GRE tunnel device, small
packets may be dropped. This occurs because the pskb_network_may_pull
function fails due to the packet's insufficient length.

For example, if only the okey option is specified for the tunnel device,
original (before encapsulation) packets smaller than 28 bytes (including
the IPv4 header) will be dropped. This happens because the required
length is calculated relative to the network header, not the skb->head.

Here is how the required length is computed and checked:

* The pull_len variable is set to 28 bytes, consisting of:
  * IPv4 header: 20 bytes
  * GRE header with Key field: 8 bytes

* The pskb_network_may_pull function adds the network offset, shifting
the checkable space further to the beginning of the network header and
extending it to the beginning of the packet. As a result, the end of
the checkable space occurs beyond the actual end of the packet.

Instead of ensuring that 28 bytes are present in skb->head, the function
is requesting these 28 bytes starting from the network header. For small
packets, this requested length exceeds the actual packet size, causing
the check to fail and the packets to be dropped.

This issue affects both locally originated and forwarded packets in
DMVPN-like setups.

How to reproduce (for local originated packets):

  ip link add dev gre1 type gre ikey 1.9.8.4 okey 1.9.8.4 \
          local <your-ip> remote 0.0.0.0

  ip link set mtu 1400 dev gre1
  ip link set up dev gre1
  ip address add 192.168.13.1/24 dev gre1
  ip neighbor add 192.168.13.2 lladdr <remote-ip> dev gre1
  ping -s 1374 -c 10 192.168.13.2
  tcpdump -vni gre1
  tcpdump -vni <your-ext-iface> 'ip proto 47'
  ip -s -s -d link show dev gre1

Solution:

Use the pskb_may_pull function instead the pskb_network_may_pull.

Fixes: 80d875cfc9d3 ("ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()")
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20240924235158.106062-1-littlesmilingcloud@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:21:35 +01:00
..
bpfilter Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netfilter netfilter: nf_tables: prevent nf_skb_duplicated corruption 2024-11-23 23:21:35 +01:00
af_inet.c gro: remove rcu_read_lock/rcu_read_unlock from gro_complete handlers 2024-11-23 23:21:04 +01:00
ah4.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arp.c arp: Prevent overflow in arp_req_get(). 2024-11-18 22:25:42 +01:00
bpf_tcp_ca.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cipso_ipv4.c cipso: fix total option length computation 2024-11-19 14:19:08 +01:00
datagram.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
devinet.c ipv4: properly combine dev_base_seq and ipv4.dev_addr_genid 2024-11-18 22:25:41 +01:00
esp4.c net: esp: cleanup esp_output_tail_tcp() in case of unsupported ESPINTCP 2024-11-23 23:20:06 +01:00
esp4_offload.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_frontend.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_lookup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_notifier.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_rules.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_semantics.c ipv4/fib: send notify when delete source address routes 2024-11-08 11:26:17 +01:00
fib_trie.c ipv4/fib: send notify when delete source address routes 2024-11-08 11:26:17 +01:00
fou.c fou: fix initialization of grc 2024-11-23 23:21:13 +01:00
gre_demux.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gre_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_complete handlers 2024-11-23 23:21:04 +01:00
icmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
igmp.c bpf: net: Change do_ip_getsockopt() to take the sockptr_t argument 2024-11-19 08:44:49 +01:00
inet_connection_sock.c tcp: properly terminate timers for kernel sockets 2024-11-19 09:22:44 +01:00
inet_diag.c inet_diag: Initialize pad field in struct inet_diag_req_v2 2024-11-19 14:19:41 +01:00
inet_fragment.c inet: inet_defrag: prevent sk release while still in use 2024-11-23 23:21:16 +01:00
inet_hashtables.c net: set SOCK_RCU_FREE before inserting socket into hashtable 2024-11-23 23:20:59 +01:00
inet_timewait_sock.c tcp: Fix NEW_SYN_RECV handling in inet_twsk_purge() 2024-11-19 11:32:40 +01:00
inetpeer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip_forward.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip_fragment.c inet: inet_defrag: prevent sk release while still in use 2024-11-23 23:21:16 +01:00
ip_gre.c ipv4: ip_gre: Fix drops of small packets in ipgre_xmit 2024-11-23 23:21:35 +01:00
ip_input.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip_options.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip_output.c net: ipv4: fix a memleak in ip_setup_cork 2024-11-18 12:13:22 +01:00
ip_sockglue.c bpf: net: Change do_ip_getsockopt() to take the sockptr_t argument 2024-11-19 08:44:49 +01:00
ip_tunnel.c Revert "net: ip_tunnel: make sure to pull inner header in ip_tunnel_rcv()" 2024-11-19 09:03:26 +01:00
ip_tunnel_core.c tunnels: fix out of bounds access when building IPv6 PMTU error 2024-11-18 12:13:24 +01:00
ip_vti.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipcomp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipconfig.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipip.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipmr.c ipmr: fix incorrect parameter validation in the ip_mroute_getsockopt() function 2024-11-19 08:44:50 +01:00
ipmr_base.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
metrics.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netfilter.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nexthop.c net: nexthop: Initialize all fields in dumped nexthops 2024-11-23 23:20:17 +01:00
ping.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
protocol.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raw_diag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
route.c ipv4: Fix incorrect source address in Record Route option 2024-11-23 23:20:17 +01:00
syncookies.c tcp: fix cookie_init_timestamp() overflows 2024-11-18 11:42:50 +01:00
sysctl_net_ipv4.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp.c tcp: Force the TCP no-delay option for everything 2024-11-19 17:33:40 +01:00
tcp_bbr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_bic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_bpf.c tcp_bpf: fix return value of tcp_bpf_sendmsg() 2024-11-23 23:21:04 +01:00
tcp_cdg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_cong.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_cubic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_dctcp.c tcp: Fix shift-out-of-bounds in dctcp_update_alpha(). 2024-11-19 12:27:09 +01:00
tcp_dctcp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_diag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_fastopen.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_highspeed.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_htcp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_hybla.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_illinois.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_input.c tcp: fix incorrect undo caused by DSACK of TLP retransmit 2024-11-19 14:19:43 +01:00
tcp_ipv4.c tcp: avoid premature drops in tcp_add_backlog() 2024-11-19 12:26:55 +01:00
tcp_lp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_metrics.c tcp_metrics: validate source addr length 2024-11-19 14:19:41 +01:00
tcp_minisocks.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_nv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_offload.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_output.c tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets 2024-11-19 11:32:45 +01:00
tcp_rate.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_recovery.c tcp: fix excessive TLP and RACK timeouts from HZ rounding 2024-11-08 11:26:10 +01:00
tcp_scalable.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_timer.c tcp: avoid too many retransmit packets 2024-11-19 14:19:44 +01:00
tcp_ulp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_vegas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_vegas.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_veno.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_westwood.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_yeah.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tunnel4.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp.c udp: Set SOCK_RCU_FREE earlier in udp_lib_get_port(). 2024-11-19 14:19:43 +01:00
udp_bpf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_diag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_impl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_complete handlers 2024-11-23 23:21:04 +01:00
udp_tunnel_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_tunnel_nic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_tunnel_stub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udplite.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm4_input.c xfrm: Preserve vlan tags for transport mode software GRO 2024-11-19 11:32:45 +01:00
xfrm4_output.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm4_policy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm4_protocol.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm4_state.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm4_tunnel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00