stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, syzbot <syzkaller@googlegroups.com>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.0 66/94] net: hsr: avoid possible NULL deref in skb_clone()
Date: Thu, 27 Oct 2022 18:55:08 +0200	[thread overview]
Message-ID: <20221027165059.842608090@linuxfoundation.org> (raw)
In-Reply-To: <20221027165057.208202132@linuxfoundation.org>

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit d8b57135fd9ffe9a5b445350a686442a531c5339 ]

syzbot got a crash [1] in skb_clone(), caused by a bug
in hsr_get_untagged_frame().

When/if create_stripped_skb_hsr() returns NULL, we must
not attempt to call skb_clone().

While we are at it, replace a WARN_ONCE() by netdev_warn_once().

[1]
general protection fault, probably for non-canonical address 0xdffffc000000000f: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000078-0x000000000000007f]
CPU: 1 PID: 754 Comm: syz-executor.0 Not tainted 6.0.0-syzkaller-02734-g0326074ff465 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:skb_clone+0x108/0x3c0 net/core/skbuff.c:1641
Code: 93 02 00 00 49 83 7c 24 28 00 0f 85 e9 00 00 00 e8 5d 4a 29 fa 4c 8d 75 7e 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 4c 89 f2 83 e2 07 38 d0 7f 08 84 c0 0f 85 9e 01 00 00
RSP: 0018:ffffc90003ccf4e0 EFLAGS: 00010207

RAX: dffffc0000000000 RBX: ffffc90003ccf5f8 RCX: ffffc9000c24b000
RDX: 000000000000000f RSI: ffffffff8751cb13 RDI: 0000000000000000
RBP: 0000000000000000 R08: 00000000000000f0 R09: 0000000000000140
R10: fffffbfff181d972 R11: 0000000000000000 R12: ffff888161fc3640
R13: 0000000000000a20 R14: 000000000000007e R15: ffffffff8dc5f620
FS: 00007feb621e4700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007feb621e3ff8 CR3: 00000001643a9000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
hsr_get_untagged_frame+0x4e/0x610 net/hsr/hsr_forward.c:164
hsr_forward_do net/hsr/hsr_forward.c:461 [inline]
hsr_forward_skb+0xcca/0x1d50 net/hsr/hsr_forward.c:623
hsr_handle_frame+0x588/0x7c0 net/hsr/hsr_slave.c:69
__netif_receive_skb_core+0x9fe/0x38f0 net/core/dev.c:5379
__netif_receive_skb_one_core+0xae/0x180 net/core/dev.c:5483
__netif_receive_skb+0x1f/0x1c0 net/core/dev.c:5599
netif_receive_skb_internal net/core/dev.c:5685 [inline]
netif_receive_skb+0x12f/0x8d0 net/core/dev.c:5744
tun_rx_batched+0x4ab/0x7a0 drivers/net/tun.c:1544
tun_get_user+0x2686/0x3a00 drivers/net/tun.c:1995
tun_chr_write_iter+0xdb/0x200 drivers/net/tun.c:2025
call_write_iter include/linux/fs.h:2187 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x9e9/0xdd0 fs/read_write.c:584
ksys_write+0x127/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Fixes: f266a683a480 ("net/hsr: Better frame dispatch")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20221017165928.2150130-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/hsr/hsr_forward.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 5bf357734b11..a50429a62f74 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -150,15 +150,15 @@ struct sk_buff *hsr_get_untagged_frame(struct hsr_frame_info *frame,
 				       struct hsr_port *port)
 {
 	if (!frame->skb_std) {
-		if (frame->skb_hsr) {
+		if (frame->skb_hsr)
 			frame->skb_std =
 				create_stripped_skb_hsr(frame->skb_hsr, frame);
-		} else {
-			/* Unexpected */
-			WARN_ONCE(1, "%s:%d: Unexpected frame received (port_src %s)\n",
-				  __FILE__, __LINE__, port->dev->name);
+		else
+			netdev_warn_once(port->dev,
+					 "Unexpected frame received in hsr_get_untagged_frame()\n");
+
+		if (!frame->skb_std)
 			return NULL;
-		}
 	}
 
 	return skb_clone(frame->skb_std, GFP_ATOMIC);
-- 
2.35.1




  parent reply	other threads:[~2022-10-27 16:59 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 16:54 [PATCH 6.0 00/94] 6.0.6-rc1 review Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 01/94] [PATCH v2] video/aperture: Call sysfb_disable() before removing PCI devices Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 02/94] ocfs2: clear dinode links count in case of error Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 03/94] ocfs2: fix BUG when iput after ocfs2_mknod fails Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 04/94] smb3: interface count displayed incorrectly Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 05/94] selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 06/94] cpufreq: qcom: fix writes in read-only memory region Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 07/94] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 08/94] cpufreq: tegra194: Fix module loading Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 09/94] x86/microcode/AMD: Apply the patch early on every logical thread Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 10/94] hwmon/coretemp: Handle large core ID value Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 11/94] ata: ahci-imx: Fix MODULE_ALIAS Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 12/94] ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 13/94] x86/resctrl: Fix min_cbm_bits for AMD Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 14/94] cpufreq: qcom: fix memory leak in error path Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 15/94] drm/amdgpu: fix sdma doorbell init ordering on APUs Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 16/94] mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 17/94] kvm: Add support for arch compat vm ioctls Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 18/94] KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 19/94] KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 20/94] KVM: arm64: vgic: Fix exit condition in scan_its_table() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 21/94] media: ipu3-imgu: Fix NULL pointer dereference in active selection access Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 22/94] media: mceusb: set timeout to at least timeout provided Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 23/94] media: venus: dec: Handle the case where find_format fails Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 24/94] media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 25/94] x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 26/94] x86/topology: Fix multiple packages shown on a single-package system Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 27/94] x86/topology: Fix duplicated core ID within a package Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 28/94] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 29/94] dm bufio: use the acquire memory barrier when testing for B_READING Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 30/94] btrfs: fix processing of delayed data refs during backref walking Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 31/94] btrfs: fix processing of delayed tree block " Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 32/94] drm/vc4: Add module dependency on hdmi-codec Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 33/94] drm/vc4: hdmi: Enforce the minimum rate at runtime_resume Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 34/94] ACPI: extlog: Handle multiple records Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 35/94] tipc: Fix recognition of trial period Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 36/94] tipc: fix an information leak in tipc_topsrv_kern_subscr Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 37/94] net: dsa: qca8k: fix inband mgmt for big-endian systems Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 38/94] net: dsa: qca8k: fix ethtool autocast mib " Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 39/94] i40e: Fix DMA mappings leak Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 40/94] tls: strp: make sure the TCP skbs do not have overlapping data Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 41/94] HID: magicmouse: Do not set BTN_MOUSE on double report Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 42/94] sfc: Change VF mac via PF as first preference if available Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 43/94] net/atm: fix proc_mpc_write incorrect return value Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 44/94] net: phy: dp83867: Extend RX strap quirk for SGMII mode Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 45/94] net/smc: Fix an error code in smc_lgr_create() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 46/94] net: phylink: add mac_managed_pm in phylink_config structure Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 47/94] net: stmmac: Enable mac_managed_pm phylink config Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 48/94] skmsg: pass gfp argument to alloc_sk_msg() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 49/94] erofs: shouldnt churn the mapping page for duplicated copies Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 50/94] blk-mq: fix null pointer dereference in blk_mq_clear_rq_mapping() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 51/94] io_uring/rw: remove leftover debug statement Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 52/94] net: ethernet: mtk_eth_soc: fix possible memory leak in mtk_probe() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 53/94] net: ethernet: mtk_eth_wed: add missing put_device() in mtk_wed_add_hw() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 54/94] net: ethernet: mtk_eth_wed: add missing of_node_put() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 55/94] scsi: lpfc: Fix memory leak in lpfc_create_port() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 56/94] udp: Update reuse->has_conns under reuseport_lock Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 57/94] ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 58/94] cifs: Fix xid leak in cifs_create() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 59/94] cifs: Fix xid leak in cifs_copy_file_range() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 60/94] cifs: Fix xid leak in cifs_flock() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 61/94] cifs: Fix xid leak in cifs_ses_add_channel() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 62/94] cifs: Fix memory leak when build ntlmssp negotiate blob failed Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 63/94] dm: remove unnecessary assignment statement in alloc_dev() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 64/94] drm/amd/display: Increase frame size limit for display_mode_vba_util_32.o Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 65/94] bnxt_en: fix memory leak in bnxt_nvm_test() Greg Kroah-Hartman
2022-10-27 16:55 ` Greg Kroah-Hartman [this message]
2022-10-27 16:55 ` [PATCH 6.0 67/94] ionic: catch NULL pointer issue on reconfig Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 68/94] netfilter: rpfilter/fib: Populate flowic_l3mdev field Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 69/94] netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 70/94] netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 71/94] nvme-hwmon: consistently ignore errors from nvme_hwmon_init Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 72/94] nvme-hwmon: kmalloc the NVME SMART log buffer Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 73/94] nvmet: fix workqueue MEM_RECLAIM flushing dependency Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 74/94] net: sched: cake: fix null pointer access issue when cake_init() fails Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 75/94] net: sched: delete duplicate cleanup of backlog and qlen Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 76/94] net: sched: sfb: fix null pointer access issue when sfb_init() fails Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 77/94] net: Fix return value of qdisc ingress handling on success Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 78/94] io_uring/msg_ring: Fix NULL pointer dereference in io_msg_send_fd() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 79/94] sfc: include vport_id in filter spec hash and equal() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 80/94] wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 81/94] net: hns: fix possible memory leak in hnae_ae_register() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 82/94] net: sched: fix race condition in qdisc_graft() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 83/94] net: phy: dp83822: disable MDI crossover status change interrupt Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 84/94] drbd: only clone bio if we have a backing device Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 85/94] rv/dot2c: Make automaton definition static Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 86/94] iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 87/94] iommu/vt-d: Clean up si_domain in the init_dmars() error path Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 88/94] wifi: mt76: mt7921e: fix random fw download fail Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 89/94] io_uring: dont gate task_work run on TIF_NOTIFY_SIGNAL Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 90/94] ext4: introduce EXT4_FC_TAG_BASE_LEN helper Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 91/94] ext4: factor out ext4_fc_get_tl() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 92/94] ext4: fix potential out of bound read in ext4_fc_replay_scan() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 93/94] [PATCH v3] ACPI: video: Force backlight native for more TongFang devices Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 94/94] mm: /proc/pid/smaps_rollup: fix no vmas null-deref Greg Kroah-Hartman
2022-10-27 17:11 ` [PATCH 6.0 00/94] 6.0.6-rc1 review Greg Kroah-Hartman
2022-10-27 18:22 ` Luna Jernberg
2022-10-27 18:46 ` Holger Hoffstätte
2022-10-27 21:13 ` Justin Forbes
2022-10-28  8:20 ` Bagas Sanjaya
2022-10-28  9:20 ` Naresh Kamboju
2022-10-28  9:25 ` Ron Economos
2022-10-28 10:18 ` Rudi Heitbaum
2022-10-28 10:35 ` Sudip Mukherjee (Codethink)
2022-10-28 11:59 ` Jon Hunter
2022-10-28 22:01 ` Florian Fainelli
2022-10-29  3:36 ` Guenter Roeck

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=20221027165059.842608090@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzkaller@googlegroups.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).