From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev,
syzbot+8400677f3fd43f37d3bc@syzkaller.appspotmail.com,
Eric Dumazet <edumazet@google.com>,
Chengen Du <chengen.du@canonical.com>,
Willem de Bruijn <willemb@google.com>,
Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.4 77/93] af_packet: fix vlan_get_tci() vs MSG_PEEK
Date: Mon, 6 Jan 2025 16:17:53 +0100 [thread overview]
Message-ID: <20250106151131.611490967@linuxfoundation.org> (raw)
In-Reply-To: <20250106151128.686130933@linuxfoundation.org>
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 77ee7a6d16b6ec07b5c3ae2b6b60a24c1afbed09 ]
Blamed commit forgot MSG_PEEK case, allowing a crash [1] as found
by syzbot.
Rework vlan_get_tci() to not touch skb at all,
so that it can be used from many cpus on the same skb.
Add a const qualifier to skb argument.
[1]
skbuff: skb_under_panic: text:ffffffff8a8da482 len:32 put:14 head:ffff88807a1d5800 data:ffff88807a1d5810 tail:0x14 end:0x140 dev:<NULL>
------------[ cut here ]------------
kernel BUG at net/core/skbuff.c:206 !
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 5880 Comm: syz-executor172 Not tainted 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:skb_panic net/core/skbuff.c:206 [inline]
RIP: 0010:skb_under_panic+0x14b/0x150 net/core/skbuff.c:216
Code: 0b 8d 48 c7 c6 9e 6c 26 8e 48 8b 54 24 08 8b 0c 24 44 8b 44 24 04 4d 89 e9 50 41 54 41 57 41 56 e8 3a 5a 79 f7 48 83 c4 20 90 <0f> 0b 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3
RSP: 0018:ffffc90003baf5b8 EFLAGS: 00010286
RAX: 0000000000000087 RBX: dffffc0000000000 RCX: 8565c1eec37aa000
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffff88802616fb50 R08: ffffffff817f0a4c R09: 1ffff92000775e50
R10: dffffc0000000000 R11: fffff52000775e51 R12: 0000000000000140
R13: ffff88807a1d5800 R14: ffff88807a1d5810 R15: 0000000000000014
FS: 00007fa03261f6c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd65753000 CR3: 0000000031720000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
skb_push+0xe5/0x100 net/core/skbuff.c:2636
vlan_get_tci+0x272/0x550 net/packet/af_packet.c:565
packet_recvmsg+0x13c9/0x1ef0 net/packet/af_packet.c:3616
sock_recvmsg_nosec net/socket.c:1044 [inline]
sock_recvmsg+0x22f/0x280 net/socket.c:1066
____sys_recvmsg+0x1c6/0x480 net/socket.c:2814
___sys_recvmsg net/socket.c:2856 [inline]
do_recvmmsg+0x426/0xab0 net/socket.c:2951
__sys_recvmmsg net/socket.c:3025 [inline]
__do_sys_recvmmsg net/socket.c:3048 [inline]
__se_sys_recvmmsg net/socket.c:3041 [inline]
__x64_sys_recvmmsg+0x199/0x250 net/socket.c:3041
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
Fixes: 79eecf631c14 ("af_packet: Handle outgoing VLAN packets without hardware offloading")
Reported-by: syzbot+8400677f3fd43f37d3bc@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6772c485.050a0220.2f3838.04c6.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Chengen Du <chengen.du@canonical.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20241230161004.2681892-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/packet/af_packet.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 88bc4a21dda4..4938926137b2 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -492,10 +492,8 @@ static void *packet_current_frame(struct packet_sock *po,
return packet_lookup_frame(po, rb, rb->head, status);
}
-static u16 vlan_get_tci(struct sk_buff *skb, struct net_device *dev)
+static u16 vlan_get_tci(const struct sk_buff *skb, struct net_device *dev)
{
- u8 *skb_orig_data = skb->data;
- int skb_orig_len = skb->len;
struct vlan_hdr vhdr, *vh;
unsigned int header_len;
@@ -516,12 +514,8 @@ static u16 vlan_get_tci(struct sk_buff *skb, struct net_device *dev)
else
return 0;
- skb_push(skb, skb->data - skb_mac_header(skb));
- vh = skb_header_pointer(skb, header_len, sizeof(vhdr), &vhdr);
- if (skb_orig_data != skb->data) {
- skb->data = skb_orig_data;
- skb->len = skb_orig_len;
- }
+ vh = skb_header_pointer(skb, skb_mac_offset(skb) + header_len,
+ sizeof(vhdr), &vhdr);
if (unlikely(!vh))
return 0;
--
2.39.5
next prev parent reply other threads:[~2025-01-06 16:00 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 15:16 [PATCH 5.4 00/93] 5.4.289-rc1 review Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 01/93] net: sched: fix ordering of qlen adjustment Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 02/93] usb: dwc2: gadget: Dont write invalid mapped sg entries into dma_desc with iommu enabled Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 03/93] PCI/AER: Disable AER service on suspend Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 04/93] ALSA: usb: Fix UBSAN warning in parse_audio_unit() Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 05/93] PCI: Add ACS quirk for Broadcom BCM5760X NIC Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 06/93] i2c: pnx: Fix timeout in wait functions Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 07/93] drm/i915: Fix memory leak by correcting cache object name in error handler Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 08/93] erofs: fix order >= MAX_ORDER warning due to crafted negative i_size Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 09/93] erofs: fix incorrect symlink detection in fast symlink Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 10/93] net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 11/93] ionic: use ee->offset when returning sprom data Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 12/93] net: hinic: Fix cleanup in create_rxqs/txqs() Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 13/93] net: ethernet: bgmac-platform: fix an OF node reference leak Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 14/93] netfilter: ipset: Fix for recursive locking warning Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 15/93] mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 16/93] chelsio/chtls: prevent potential integer overflow on 32bit Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 17/93] i2c: riic: Always round-up when calculating bus period Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 18/93] efivarfs: Fix error on non-existent file Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 19/93] USB: serial: option: add TCL IK512 MBIM & ECM Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 20/93] USB: serial: option: add MeiG Smart SLM770A Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 21/93] USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 22/93] USB: serial: option: add MediaTek T7XX compositions Greg Kroah-Hartman
2025-01-06 15:16 ` [PATCH 5.4 23/93] USB: serial: option: add Telit FE910C04 rmnet compositions Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 24/93] sh: clk: Fix clk_enable() to return 0 on NULL clk Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 25/93] zram: refuse to use zero sized block device as backing device Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 26/93] btrfs: tree-checker: reject inline extent items with 0 ref count Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 27/93] NFS/pnfs: Fix a live lock between recalled layouts and layoutget Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 28/93] of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 29/93] nilfs2: prevent use of deleted inode Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 30/93] udmabuf: also check for F_SEAL_FUTURE_WRITE Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 31/93] of: Fix error path in of_parse_phandle_with_args_map() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 32/93] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 33/93] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 34/93] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 35/93] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 36/93] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 37/93] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 38/93] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 39/93] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 40/93] phy: core: Fix that API devm_phy_destroy() fails to destroy " Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 41/93] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 42/93] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 43/93] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 44/93] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 45/93] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 46/93] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 47/93] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 48/93] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 49/93] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 50/93] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 51/93] epoll: Add synchronous wakeup support for ep_poll_callback Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 52/93] MIPS: Probe toolchain support of -msym32 Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 53/93] skbuff: introduce skb_expand_head() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 54/93] ipv6: use skb_expand_head in ip6_finish_output2 Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 55/93] ipv6: use skb_expand_head in ip6_xmit Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 56/93] ipv6: fix possible UAF in ip6_finish_output2() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 57/93] bpf: fix recursive lock when verdict program return SK_PASS Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 58/93] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 59/93] btrfs: avoid monopolizing a core when activating a swap file Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 60/93] skb_expand_head() adjust skb->truesize incorrectly Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 61/93] ipv6: prevent possible UAF in ip6_xmit() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 62/93] selinux: ignore unknown extended permissions Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 63/93] Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 64/93] IB/mlx5: Introduce and use mlx5_core_is_vf() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 65/93] net/mlx5: Make API mlx5_core_is_ecpf accept const pointer Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 66/93] RDMA/mlx5: Enforce same type port association for multiport RoCE Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 67/93] RDMA/bnxt_re: Add check for path mtu in modify_qp Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 68/93] RDMA/bnxt_re: Fix reporting hw_ver in query_device Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 69/93] RDMA/bnxt_re: Fix max_qp_wrs reported Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 70/93] drm: bridge: adv7511: Enable SPDIF DAI Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 71/93] drm/bridge: adv7511_audio: Update Audio InfoFrame properly Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 72/93] netrom: check buffer length before accessing it Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 73/93] netfilter: Replace zero-length array with flexible-array member Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 74/93] netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 75/93] net: llc: reset skb->transport_header Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 76/93] ALSA: usb-audio: US16x08: Initialize array before use Greg Kroah-Hartman
2025-01-06 15:17 ` Greg Kroah-Hartman [this message]
2025-01-06 15:17 ` [PATCH 5.4 78/93] af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 79/93] ila: serialize calls to nf_register_net_hooks() Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 80/93] wifi: mac80211: wake the queues in case of failure in resume Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 81/93] sound: usb: format: dont warn that raw DSD is unsupported Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 82/93] bpf: fix potential error return Greg Kroah-Hartman
2025-01-06 15:17 ` [PATCH 5.4 83/93] net: usb: qmi_wwan: add Telit FE910C04 compositions Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 84/93] irqchip/gic: Correct declaration of *percpu_base pointer in union gic_base Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 85/93] ARC: build: Try to guess GCC variant of cross compiler Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 86/93] modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 87/93] modpost: fix the missed iteration for the max bit in do_input() Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 88/93] RDMA/uverbs: Prevent integer overflow issue Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 89/93] pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 90/93] sky2: Add device ID 11ab:4373 for Marvell 88E8075 Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 91/93] net/sctp: Prevent autoclose integer overflow in sctp_association_init() Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 92/93] drm: adv7511: Drop dsi single lane support Greg Kroah-Hartman
2025-01-06 15:18 ` [PATCH 5.4 93/93] mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim() Greg Kroah-Hartman
2025-01-06 18:58 ` [PATCH 5.4 00/93] 5.4.289-rc1 review Florian Fainelli
2025-01-07 12:43 ` Jon Hunter
2025-01-07 13:50 ` Naresh Kamboju
2025-01-07 23:16 ` Shuah Khan
2025-01-08 13:00 ` Muhammad Usama Anjum
2025-01-09 10:12 ` Greg Kroah-Hartman
2025-01-09 14:10 ` Muhammad Usama Anjum
2025-01-09 14:14 ` Mark Brown
2025-01-08 14:13 ` Harshit Mogalapalli
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=20250106151131.611490967@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=chengen.du@canonical.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+8400677f3fd43f37d3bc@syzkaller.appspotmail.com \
--cc=willemb@google.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).