public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Xiaokun <shinnkka1@gmail.com>
To: stable@vger.kernel.org
Cc: sashal@kernel.org, axboe@kernel.dk, asml.silence@gmail.com,
	felix.moessbauer@siemens.com, gregkh@linuxfoundation.org,
	io-uring@vger.kernel.org, Chen Xiaokun <shinnkka1@gmail.com>
Subject: [PATCH 6.1.y v2] io_uring/io-wq: Fix memory leak in io_wq_create() on success path
Date: Wed, 23 Sep 2026 14:43:15 +0800	[thread overview]
Message-ID: <20260923064315.195997-1-shinnkka1@gmail.com> (raw)

[ This is a stable-only patch for 6.1.y ]

Commit 657ca82526d0 ("io_uring/io-wq: inherit cpuset of cgroup in io
worker") was backported from upstream commit 84eacf177faa to 6.1.y.

In linux-6.1.y, this backport introduced a temporary allowed_mask 
variable in io_wq_create().  It is correctly freed on the error path,
but is not freed on the success path.  As a result, every successful
call to io_wq_create() leaks cpumask_size() bytes of memory.

This is a 6.1-specific backport issue caused by the differences in the
io-wq implementation, so the fix only applies to 6.1.y.

Fixes: 657ca82526d0 ("io_uring/io-wq: inherit cpuset of cgroup in io worker")
Signed-off-by: Chen Xiaokun <shinnkka1@gmail.com>

---
Hi Greg, Sasha, and io-uring maintainers,

This patch is specific to 6.1.y.  Commit 657ca82526d0 was a manual
backport of upstream commit 84eacf177faa ("io_uring/io-wq: inherit
cpuset of cgroup in io worker").  Due to significant differences in
the io-wq implementation between 6.1 and later kernels, the upstream
change had to be adapted for 6.1.

Later stable kernels do not contain this 6.1-specific backported
implementation of io_wq_create(), and therefore do not contain the
leaked allowed_mask.  The corresponding upstream implementation also
does not have this allocation.

Therefore, this fix is only applicable to 6.1.y and should not be
backported to other stable kernel series.

upstream patch: https://lore.kernel.org/all/20240910171157.166423-3-felix.moessbauer@siemens.com/
backport patch: https://lore.kernel.org/all/20240911162316.516725-3-felix.moessbauer@siemens.com/

Could you please queue it for 6.1.y?

Thanks,
Chen Xiaokun

Changes since v1:
- Reword the commit message (clarify that this is a 6.1-specific backport patch)
- No functional changes

 io_uring/io-wq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index 0c3de2fead81..f1bc212309c8 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -1221,6 +1221,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
 	wq->task = get_task_struct(data->task);
 	atomic_set(&wq->worker_refs, 1);
 	init_completion(&wq->worker_done);
+	free_cpumask_var(allowed_mask);
 	return wq;
 err:
 	io_wq_put_hash(data->hash);
-- 
2.55.0


             reply	other threads:[~2026-09-23  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  6:43 Chen Xiaokun [this message]
2026-09-23 11:08 ` [PATCH 6.1.y v2] io_uring/io-wq: Fix memory leak in io_wq_create() on success path MOESSBAUER, Felix
2026-09-24  0:20 ` Sasha Levin

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=20260923064315.195997-1-shinnkka1@gmail.com \
    --to=shinnkka1@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=felix.moessbauer@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=io-uring@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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