From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Shigeru Yoshida <syoshida@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Suman Ghosh <sumang@marvell.com>, Paolo Abeni <pabeni@redhat.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 31/97] ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()
Date: Mon, 11 Dec 2023 19:21:34 +0100 [thread overview]
Message-ID: <20231211182021.100322203@linuxfoundation.org> (raw)
In-Reply-To: <20231211182019.802717483@linuxfoundation.org>
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <syoshida@redhat.com>
[ Upstream commit 80d875cfc9d3711a029f234ef7d680db79e8fa4b ]
In ipgre_xmit(), skb_pull() may fail even if pskb_inet_may_pull() returns
true. For example, applications can use PF_PACKET to create a malformed
packet with no IP header. This type of packet causes a problem such as
uninit-value access.
This patch ensures that skb_pull() can pull the required size by checking
the skb with pskb_network_may_pull() before skb_pull().
Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Suman Ghosh <sumang@marvell.com>
Link: https://lore.kernel.org/r/20231202161441.221135-1-syoshida@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/ip_gre.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9d1a506571043..a6ad0fe1387c0 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -629,15 +629,18 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
}
if (dev->header_ops) {
+ int pull_len = tunnel->hlen + sizeof(struct iphdr);
+
if (skb_cow_head(skb, 0))
goto free_skb;
tnl_params = (const struct iphdr *)skb->data;
- /* Pull skb since ip_tunnel_xmit() needs skb->data pointing
- * to gre header.
- */
- skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
+ if (!pskb_network_may_pull(skb, pull_len))
+ goto free_skb;
+
+ /* ip_tunnel_xmit() needs skb->data pointing to gre header. */
+ skb_pull(skb, pull_len);
skb_reset_mac_header(skb);
if (skb->ip_summed == CHECKSUM_PARTIAL &&
--
2.42.0
next prev parent reply other threads:[~2023-12-11 18:39 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 18:21 [PATCH 5.10 00/97] 5.10.204-rc1 review Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 01/97] hrtimers: Push pending hrtimers away from outgoing CPU earlier Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 02/97] i2c: designware: Fix corrupted memory seen in the ISR Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 03/97] netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 04/97] tg3: Move the [rt]x_dropped counters to tg3_napi Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 05/97] tg3: Increment tx_dropped in tg3_tso_bug() Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 06/97] kconfig: fix memory leak from range properties Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 07/97] drm/amdgpu: correct chunk_ptr to a pointer to chunk Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 08/97] platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360 Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 09/97] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 10/97] platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 11/97] asus-wmi: Add dgpu disable method Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 12/97] platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 13/97] platform/x86: asus-wmi: Add support for ROG X13 tablet mode Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 14/97] platform/x86: asus-wmi: Simplify tablet-mode-switch probing Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 15/97] platform/x86: asus-wmi: Simplify tablet-mode-switch handling Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 16/97] platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 17/97] of: base: Fix some formatting issues and provide missing descriptions Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 18/97] of: Fix kerneldoc output formatting Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 19/97] of: Add missing Return section in kerneldoc comments Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 20/97] of: dynamic: Fix of_reconfig_get_state_change() return value documentation Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 21/97] ipv6: fix potential NULL deref in fib6_add() Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 22/97] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 23/97] hv_netvsc: rndis_filter needs to select NLS Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 24/97] mlxbf-bootctl: correctly identify secure boot with development keys Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 25/97] net: arcnet: com20020 fix error handling Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 26/97] arcnet: restoring support for multiple Sohard Arcnet cards Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 27/97] i40e: Fix unexpected MFS warning message Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 28/97] net: bnxt: fix a potential use-after-free in bnxt_init_tc Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 29/97] ionic: fix snprintf format length warning Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 30/97] ionic: Fix dim work handling in split interrupt mode Greg Kroah-Hartman
2023-12-11 18:21 ` Greg Kroah-Hartman [this message]
2023-12-11 18:21 ` [PATCH 5.10 32/97] net: hns: fix fake link up on xge port Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 33/97] netfilter: xt_owner: Fix for unsafe access of sk->sk_socket Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 34/97] tcp: do not accept ACK of bytes we never sent Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 35/97] bpf: sockmap, updating the sg structure should also update curr Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 36/97] tee: optee: Fix supplicant based device enumeration Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 37/97] arm64: dts: rockchip: Expand reg size of vdec node for RK3399 Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 38/97] RDMA/rtrs-clt: Remove the warnings for req in_use check Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 39/97] RDMA/bnxt_re: Correct module description string Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 40/97] hwmon: (acpi_power_meter) Fix 4.29 MW bug Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 41/97] ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 42/97] tracing: Fix a warning when allocating buffered events fails Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 43/97] scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 44/97] ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 45/97] ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 46/97] riscv: fix misaligned access handling of C.SWSP and C.SDSP Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 47/97] ALSA: pcm: fix out-of-bounds in snd_pcm_state_names Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 48/97] ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5 Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 49/97] nilfs2: fix missing error check for sb_set_blocksize call Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 50/97] nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 51/97] checkstack: fix printed address Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 52/97] tracing: Always update snapshot buffer size Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 53/97] tracing: Disable snapshot buffer when stopping instance tracers Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 54/97] tracing: Fix incomplete locking when disabling buffered events Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 55/97] tracing: Fix a possible race " Greg Kroah-Hartman
2023-12-11 18:21 ` [PATCH 5.10 56/97] packet: Move reference count in packet_sock to atomic_long_t Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 57/97] arm64: dts: mediatek: mt7622: fix memory node warning check Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 58/97] arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 59/97] arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 60/97] misc: mei: client.c: return negative error code in mei_cl_write Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 61/97] misc: mei: client.c: fix problem of return -EOVERFLOW " Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 62/97] ring-buffer: Force absolute timestamp on discard of event Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 63/97] tracing: Set actual size after ring buffer resize Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 64/97] tracing: Stop current tracer when resizing buffer Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 65/97] perf/core: Add a new read format to get a number of lost samples Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 66/97] perf: Fix perf_event_validate_size() Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 67/97] gpiolib: sysfs: Fix error handling on failed export Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 68/97] drm/amdgpu: correct the amdgpu runtime dereference usage count Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 69/97] usb: gadget: f_hid: fix report descriptor allocation Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 70/97] parport: Add support for Brainboxes IX/UC/PX parallel cards Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 71/97] Revert "xhci: Loosen RPM as default policy to cover for AMD xHC 1.1" Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 72/97] usb: typec: class: fix typec_altmode_put_partner to put plugs Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 73/97] ARM: PL011: Fix DMA support Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 74/97] serial: sc16is7xx: address RX timeout interrupt errata Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 75/97] serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 76/97] serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 77/97] serial: 8250_omap: Add earlycon support for the AM654 UART controller Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 78/97] x86/CPU/AMD: Check vendor in the AMD microcode callback Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 79/97] KVM: s390/mm: Properly reset no-dat Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 80/97] MIPS: Loongson64: Reserve vgabios memory on boot Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support Greg Kroah-Hartman
2023-12-30 19:38 ` Salvatore Bonaccorso
2023-12-30 23:16 ` Jiaxun Yang
2023-12-31 9:33 ` Salvatore Bonaccorso
2024-01-03 10:40 ` Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 82/97] io_uring/af_unix: disable sending io_uring over sockets Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 83/97] netlink: dont call ->netlink_bind with table lock held Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 84/97] genetlink: add CAP_NET_ADMIN test for multicast bind Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 85/97] psample: Require CAP_NET_ADMIN when joining "packets" group Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 86/97] drop_monitor: Require CAP_SYS_ADMIN when joining "events" group Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 87/97] netfilter: nft_set_pipapo: skip inactive elements during set walk Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 88/97] platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 89/97] tools headers UAPI: Sync linux/perf_event.h with the kernel sources Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 90/97] platform/x86: asus-wmi: Document the dgpu_disable sysfs attribute Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 91/97] mmc: block: Be sure to wait while busy in CQE error recovery Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 92/97] Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem" Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 93/97] cifs: Fix non-availability of dedup breaking generic/304 Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 94/97] smb: client: fix potential NULL deref in parse_dfs_referrals() Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 95/97] devcoredump : Serialize devcd_del work Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 96/97] devcoredump: Send uevent once devcd is ready Greg Kroah-Hartman
2023-12-11 18:22 ` [PATCH 5.10 97/97] r8169: fix rtl8125b PAUSE frames blasting when suspended Greg Kroah-Hartman
2023-12-11 19:17 ` [PATCH 5.10 00/97] 5.10.204-rc1 review Florian Fainelli
2023-12-12 16:29 ` Naresh Kamboju
2023-12-12 17:01 ` Guenter Roeck
2023-12-12 19:08 ` Pavel Machek
2023-12-12 22:20 ` Jon Hunter
2023-12-13 3:43 ` Dominique Martinet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231211182021.100322203@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=edumazet@google.com \
--cc=pabeni@redhat.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=sumang@marvell.com \
--cc=syoshida@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).