Archive-only list for patches
 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,
	Gabriel Krisman Bertazi <krisman@suse.de>,
	Vishnu Razdan <vrazdan@openai.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 05/92] io_uring/io-wq: fix worker accounting when canceling creation callbacks
Date: Mon, 31 Aug 2026 15:34:03 +0200	[thread overview]
Message-ID: <20260831133359.748364699@linuxfoundation.org> (raw)
In-Reply-To: <20260831133359.482388899@linuxfoundation.org>

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

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

From: Vishnu Razdan <vrazdan@openai.com>

commit 297b5ccea4acacaa47c150f043bce695202afbf1 upstream.

create_worker_cb() reserves an io-wq worker slot only after its
task-work callback runs. If the callback is canceled before then,
io_worker_cancel_cb() still decrements acct->nr_workers. When an
existing worker retires with its creation callback pending, that
worker has already decremented the same account's worker count.

The resulting undercount permits worker creation beyond the account's
configured limit. On an AST2600 OpenBMC system, an unchanged sensor
daemon reached 4,291 threads with the original kernel. With an
equivalent downstream fix, 25 passive samples under its normal
workload showed 6-9 threads.

Decrement nr_workers only when the canceled callback is not
create_worker_cb(). Continuation callbacks still release their reserved
slot, and both callback types retain the existing running-count,
reference-count, and create-state cleanup.

[ Backport: retain the existing worker->wqe->lock protecting worker
  accounting. ]

Fixes: 1d5f5ea7cb7d ("io-wq: remove worker to owner tw dependency")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6-sol
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Link: https://patch.msgid.link/20260811-vrazdan-io-wq-b4-submit-v1-1-719ced16c921@openai.com
Signed-off-by: Vishnu Razdan <vrazdan@openai.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 io_uring/io-wq.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index 66fdd69fd6cb4..0c3de2fead81c 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -201,9 +201,12 @@ static void io_worker_cancel_cb(struct io_worker *worker)
 	struct io_wq *wq = wqe->wq;
 
 	atomic_dec(&acct->nr_running);
-	raw_spin_lock(&worker->wqe->lock);
-	acct->nr_workers--;
-	raw_spin_unlock(&worker->wqe->lock);
+	/* create_worker_cb() has not reserved a worker slot yet. */
+	if (worker->create_work.func != create_worker_cb) {
+		raw_spin_lock(&worker->wqe->lock);
+		acct->nr_workers--;
+		raw_spin_unlock(&worker->wqe->lock);
+	}
 	io_worker_ref_put(wq);
 	clear_bit_unlock(0, &worker->create_state);
 	io_worker_release(worker);
-- 
2.53.0




  parent reply	other threads:[~2026-08-31 13:58 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 13:33 [PATCH 6.1 00/92] 6.1.187-rc1 review Greg Kroah-Hartman
2026-08-31 13:33 ` [PATCH 6.1 01/92] RDMA/rxe: Fix OOB in free_rd_atomic_resources() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 02/92] inet: RAW sockets using IPPROTO_RAW MUST drop incoming ICMP Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 03/92] KVM: x86/mmu: Check write tracking in all address spaces Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 04/92] ext4: dont enable DAX on new encrypted files Greg Kroah-Hartman
2026-08-31 13:34 ` Greg Kroah-Hartman [this message]
2026-08-31 13:34 ` [PATCH 6.1 06/92] ipvs: reload ip header after head reallocation Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 07/92] Revert "usb: phy: fsl-usb: Fix use-after-free in delayed work during device removal" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 08/92] wifi: ath11k: Add missing hw_ops->get_ring_selector() for IPQ5018 Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 09/92] drm/nouveau/kms/nv50-: init hpd_irq_lock for PIOR DP Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 10/92] bpf: Remove tst_run from lwt_seg6local_prog_ops Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 11/92] jfs: add check read-only before truncation in jfs_truncate_nolock() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 12/92] jfs: add check read-only before txBeginAnon() call Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 13/92] ibmvnic: Use kernel helpers for hex dumps Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 14/92] jfs: Fix null-ptr-deref in jfs_ioc_trim Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 15/92] exfat: fix double free in delayed_free Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 16/92] media: platform: exynos4-is: Add hardware sync wait to fimc_is_hw_change_mode() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 17/92] mISDN: hfcpci: Fix warning when deleting uninitialized timer Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 18/92] can: j1939: implement NETDEV_UNREGISTER notification handler Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 19/92] can: j1939: add missing calls in " Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 20/92] can: j1939: make j1939_sk_bind() fail if device is no longer registered Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 21/92] smc: Fix use-after-free in __pnet_find_base_ndev() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 22/92] KVM: arm64: Prevent access to vCPU events before init Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 23/92] smc: Use __sk_dst_get() and dst_dev_rcu() in in smc_clc_prfx_set() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 24/92] smc: Use __sk_dst_get() and dst_dev_rcu() in smc_clc_prfx_match() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 25/92] ASoC: nau8821: Cancel delayed work on component remove Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 26/92] bpf: Fix use-after-free in offloaded map/prog info fill Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 27/92] riscv: Fix register corruption from uninitialized cregs on error Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 28/92] Revert "PM: sleep: Use complete() in device_pm_sleep_init()" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 29/92] ASoC: nau8821: Cancel pending work before suspend Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 30/92] smc: Use __sk_dst_get() and dst_dev_rcu() in smc_vlan_by_tcpsk() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 31/92] selinux: switch two allocations to use kzalloc_objs() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 32/92] Revert "mtd: maps: vmu-flash: fix fault in unaligned fixup" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 33/92] Revert "smb: client: use kvzalloc() for megabyte buffer in simple fallocate" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 34/92] ASoC: tegra: Fix Master Volume Control Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 35/92] block: make bio_check_eod work for zero sized devices Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 36/92] mptcp: pm: fix memory leak from alloc-during-teardown race Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 37/92] ext4: propagate errors from fast commit range replay Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 38/92] nilfs2: correct return value kernel-doc descriptions for ioctl functions Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 39/92] nilfs2: reject invalid block index in GC ioctl Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 40/92] nfc: nci: add data_len bound checks to activation parameter extractors Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 41/92] HID: magicmouse: fix battery reporting for Bluetooth Magic Trackpad USB-C Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 42/92] HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 43/92] HID: magicmouse: re-enable multitouch after reset-resume Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 44/92] nvme: rename CDR/MORE/DNR to NVME_STATUS_* Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 45/92] nvmet-tcp: bound SGL data length before allocating command buffers Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 46/92] HID: nintendo: stop device IO before hid_hw_stop on probe failure Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 47/92] HID: uclogic: fix use-after-free of inrange_timer on remove Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 48/92] HID: ft260: improve i2c write performance Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 49/92] HID: ft260: improve i2c large reads performance Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 50/92] HID: ft260: skip unexpected HID input reports Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 51/92] HID: ft260: wake up device from power saving mode Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 55/92] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 56/92] Bluetooth: hci_sync: Fix accept list UAF during suspend Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 57/92] Bluetooth: hci_conn: Fix not matching by CIS ID Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 58/92] Bluetooth: ISO: use correct CIS order in Set CIG Parameters event Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 59/92] Bluetooth: hci_event: fix Set CIG Parameters error status handling Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 60/92] Bluetooth: hci_event: validate LE Set CIG Parameters response Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 6.1 61/92] ipv4: igmp: Fix potential UAF in igmp_gq_start_timer() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 62/92] fpga: dfl: fme: add error handling Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 63/92] accessibility: speakup: unregister tty ldisc on later init failures Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 64/92] usb: xhci: Handle USB3 port events when there is one roothub Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 65/92] xhci: dbgtty: Fix unregister on tty_register_driver() failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 66/92] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 67/92] fuse: fix invalidate lock leak on setattr writeback failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 68/92] fuse: fix invalidate lock leak on open O_TRUNC DAX failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 69/92] usb: usbtest: disable dynamic ID support Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 70/92] usb: gadget: f_tcm: keep port count until LUN teardown completes Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 71/92] tls: device: fix out-of-bounds write in tls_append_frag() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 72/92] xfrm: espintcp: fix UAF during close Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 73/92] xfrm: drop ESP-in-TCP packets with no ingress device Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 74/92] xfrm: ah6: validate routing header segments_left Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 75/92] xfrm: fix xfrm_state_construct() auth-trunc leak Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 76/92] net: bridge: mcast: fix use-after-free of a master VLANs multicast context Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 77/92] ipv6: seg6: clear IPv4 control block on IPIP decapsulation Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 80/92] crypto: qce - fix CCM AAD buffer underallocation Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 81/92] crypto: mxs-dcp - fix source scatterlist length access Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 82/92] crypto: qce - Remove unsafe/deprecated algorithms Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 83/92] KVM: s390: vsie: zero stale crypto bits Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 84/92] Bluetooth: hci_core: Fix hci_conn_hash_lookup_cis Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 85/92] usb: core: Add lock to usb_wakeup_notification() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 86/92] usb: core: Strengthen error handling in hub_hub_status() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 87/92] ALSA: usb-audio: fix OOB write in snd_usbmidi_novation_output() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 88/92] ALSA: usb-audio: Complete cleanup after system-resume errors Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 89/92] USB: serial: option: fix slab OOB read in interrupt URB callback Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 90/92] USB: serial: spcp8x5: drop broken carrier detect support Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 91/92] USB: c67x00: fix use-after-free in c67x00_add_iso_urb() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 6.1 92/92] usb: usbfs: fix use-after-free of usb_device in usbdev_release() Greg Kroah-Hartman
2026-08-31 17:50 ` [PATCH 6.1 00/92] 6.1.187-rc1 review Florian Fainelli
2026-08-31 18:15 ` Francesco Dolcini
2026-08-31 19:12 ` Brett A C Sheffield
2026-08-31 19:41 ` Peter Schneider
2026-09-01  8:45 ` Pavel Machek
2026-09-01 11:36 ` Barry K. Nathan
2026-09-01 16:46 ` Shuah Khan
2026-09-01 22:25 ` Miguel Ojeda
2026-09-01 23:26 ` Ron Economos

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=20260831133359.748364699@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=krisman@suse.de \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vrazdan@openai.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