public inbox for stable@vger.kernel.org
 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, Lizhi Xu <lizhi.xu@windriver.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Stefan Schmidt <stefan@datenfreihafen.org>,
	Sasha Levin <sashal@kernel.org>,
	syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.com
Subject: [PATCH 6.1 19/64] mac802154: check local interfaces before deleting sdata list
Date: Tue, 21 Jan 2025 18:52:18 +0100	[thread overview]
Message-ID: <20250121174522.293124402@linuxfoundation.org> (raw)
In-Reply-To: <20250121174521.568417761@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lizhi Xu <lizhi.xu@windriver.com>

[ Upstream commit eb09fbeb48709fe66c0d708aed81e910a577a30a ]

syzkaller reported a corrupted list in ieee802154_if_remove. [1]

Remove an IEEE 802.15.4 network interface after unregister an IEEE 802.15.4
hardware device from the system.

CPU0					CPU1
====					====
genl_family_rcv_msg_doit		ieee802154_unregister_hw
ieee802154_del_iface			ieee802154_remove_interfaces
rdev_del_virtual_intf_deprecated	list_del(&sdata->list)
ieee802154_if_remove
list_del_rcu

The net device has been unregistered, since the rcu grace period,
unregistration must be run before ieee802154_if_remove.

To avoid this issue, add a check for local->interfaces before deleting
sdata list.

[1]
kernel BUG at lib/list_debug.c:58!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 6277 Comm: syz-executor157 Not tainted 6.12.0-rc6-syzkaller-00005-g557329bcecc2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:__list_del_entry_valid_or_report+0xf4/0x140 lib/list_debug.c:56
Code: e8 a1 7e 00 07 90 0f 0b 48 c7 c7 e0 37 60 8c 4c 89 fe e8 8f 7e 00 07 90 0f 0b 48 c7 c7 40 38 60 8c 4c 89 fe e8 7d 7e 00 07 90 <0f> 0b 48 c7 c7 a0 38 60 8c 4c 89 fe e8 6b 7e 00 07 90 0f 0b 48 c7
RSP: 0018:ffffc9000490f3d0 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: d211eee56bb28d00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffff88805b278dd8 R08: ffffffff8174a12c R09: 1ffffffff2852f0d
R10: dffffc0000000000 R11: fffffbfff2852f0e R12: dffffc0000000000
R13: dffffc0000000000 R14: dead000000000100 R15: ffff88805b278cc0
FS:  0000555572f94380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000056262e4a3000 CR3: 0000000078496000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __list_del_entry_valid include/linux/list.h:124 [inline]
 __list_del_entry include/linux/list.h:215 [inline]
 list_del_rcu include/linux/rculist.h:157 [inline]
 ieee802154_if_remove+0x86/0x1e0 net/mac802154/iface.c:687
 rdev_del_virtual_intf_deprecated net/ieee802154/rdev-ops.h:24 [inline]
 ieee802154_del_iface+0x2c0/0x5c0 net/ieee802154/nl-phy.c:323
 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2551
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
 netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
 netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:729 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:744
 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2607
 ___sys_sendmsg net/socket.c:2661 [inline]
 __sys_sendmsg+0x292/0x380 net/socket.c:2690
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported-and-tested-by: syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=985f827280dc3a6e7e92
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/20241113095129.1457225-1-lizhi.xu@windriver.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac802154/iface.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 7e2065e729156..0233929502ec2 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -689,6 +689,10 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
 	ASSERT_RTNL();
 
 	mutex_lock(&sdata->local->iflist_mtx);
+	if (list_empty(&sdata->local->interfaces)) {
+		mutex_unlock(&sdata->local->iflist_mtx);
+		return;
+	}
 	list_del_rcu(&sdata->list);
 	mutex_unlock(&sdata->local->iflist_mtx);
 
-- 
2.39.5




  parent reply	other threads:[~2025-01-21 18:03 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 17:51 [PATCH 6.1 00/64] 6.1.127-rc1 review Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 01/64] net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 02/64] bpf: Fix bpf_sk_select_reuseport() memory leak Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 03/64] openvswitch: fix lockup on tx to unregistering netdev with carrier Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 04/64] pktgen: Avoid out-of-bounds access in get_imix_entries Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 05/64] net: add exit_batch_rtnl() method Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 06/64] gtp: use " Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 07/64] gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 08/64] gtp: Destroy device along with udp sockets netns dismantle Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 09/64] nfp: bpf: prevent integer overflow in nfp_bpf_event_output() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 10/64] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 11/64] net/mlx5: Fix RDMA TX steering prio Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 12/64] net/mlx5: Clear port select structure when fail to create Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 13/64] drm/v3d: Ensure job pointer is set to NULL after job completion Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 14/64] hwmon: (tmp513) Fix division of negative numbers Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 15/64] Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data" Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 16/64] i2c: mux: demux-pinctrl: check initial mux selection, too Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 17/64] i2c: rcar: fix NACK handling when being a target Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 18/64] nvmet: propagate npwg topology Greg Kroah-Hartman
2025-01-21 17:52 ` Greg Kroah-Hartman [this message]
2025-01-21 17:52 ` [PATCH 6.1 20/64] hfs: Sanity check the root record Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 21/64] fs: fix missing declaration of init_files Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 22/64] kheaders: Ignore silly-rename files Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 23/64] cachefiles: Parse the "secctx" immediately Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 24/64] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 25/64] selftests: tc-testing: reduce rshift value Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 26/64] ACPI: resource: acpi_dev_irq_override(): Check DMI match last Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 27/64] iomap: avoid avoid truncating 64-bit offset to 32 bits Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 28/64] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 29/64] x86/asm: Make serialize() always_inline Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 30/64] ALSA: hda/realtek: Add support for Ayaneo System using CS35L41 HDA Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 31/64] zram: fix potential UAF of zram table Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 32/64] mptcp: be sure to send ack when mptcp-level window re-opens Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 33/64] selftests: mptcp: avoid spurious errors on disconnect Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 34/64] net: ethernet: xgbe: re-add aneg to supported features in PHY quirks Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 35/64] vsock/virtio: discard packets if the transport changes Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 36/64] vsock/virtio: cancel close work in the destructor Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 37/64] vsock: reset socket state when de-assigning the transport Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 38/64] vsock: prevent null-ptr-deref in vsock_*[has_data|has_space] Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 39/64] filemap: avoid truncating 64-bit offset to 32 bits Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 40/64] fs/proc: fix softlockup in __read_vmcore (part 2) Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 41/64] gpiolib: cdev: Fix use after free in lineinfo_changed_notify Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 42/64] pmdomain: imx8mp-blk-ctrl: add missing loop break condition Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 43/64] irqchip: Plug a OF node reference leak in platform_irqchip_probe() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 44/64] irqchip/gic-v3: Handle CPU_PM_ENTER_FAILED correctly Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 45/64] irqchip/gic-v3-its: Dont enable interrupts in its_irq_set_vcpu_affinity() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 46/64] hrtimers: Handle CPU state correctly on hotplug Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 47/64] drm/i915/fb: Relax clear color alignment to 64 bytes Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 48/64] Revert "PCI: Use preserve_config in place of pci_flags" Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 49/64] iio: imu: inv_icm42600: fix spi burst write not supported Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 50/64] iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 51/64] iio: adc: rockchip_saradc: fix information leak in triggered buffer Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 52/64] drm/amd/display: Fix out-of-bounds access in dcn21_link_encoder_create Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 53/64] drm/amdgpu: fix usage slab after free Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 54/64] block: fix uaf for flush rq while iterating tags Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 55/64] Revert "drm/amdgpu: rework resume handling for display (v2)" Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 56/64] RDMA/rxe: Fix the qp flush warnings in req Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 57/64] scsi: sg: Fix slab-use-after-free read in sg_release() Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 58/64] Revert "regmap: detach regmap from dev on regmap_exit" Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 59/64] wifi: ath10k: avoid NULL pointer error during sdio remove Greg Kroah-Hartman
2025-01-21 17:52 ` [PATCH 6.1 60/64] erofs: tidy up EROFS on-disk naming Greg Kroah-Hartman
2025-01-21 17:53 ` [PATCH 6.1 61/64] erofs: handle NONHEAD !delta[1] lclusters gracefully Greg Kroah-Hartman
2025-01-21 17:53 ` [PATCH 6.1 62/64] nfsd: add list_head nf_gc to struct nfsd_file Greg Kroah-Hartman
2025-01-21 17:53 ` [PATCH 6.1 63/64] x86/xen: fix SLS mitigation in xen_hypercall_iret() Greg Kroah-Hartman
2025-01-21 17:53 ` [PATCH 6.1 64/64] net: fix data-races around sk->sk_forward_alloc Greg Kroah-Hartman
2025-01-21 18:44 ` [PATCH 6.1 00/64] 6.1.127-rc1 review Florian Fainelli
2025-01-21 19:32 ` Peter Schneider
2025-01-21 21:57   ` Salvatore Bonaccorso
2025-01-22  7:35     ` Greg Kroah-Hartman
2025-01-22  7:38       ` Greg Kroah-Hartman
2025-01-22  5:32   ` Ron Economos
2025-01-21 23:35 ` Shuah Khan
2025-01-21 23:46 ` SeongJae Park
2025-01-22 20:17 ` [PATCH 6.1] " Hardik Garg

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=20250121174522.293124402@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=lizhi.xu@windriver.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    --cc=syzbot+985f827280dc3a6e7e92@syzkaller.appspotmail.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