From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f12.google.com (mail-pj2-f12.google.com [74.125.227.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86848415F06 for ; Wed, 23 Sep 2026 06:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.140 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790145815; cv=none; b=Ud2/HOoVRp8w6kEg9QusmuN6bcQMvzO/2hChtPGQQaw337VPJac6t15ctWeLNpqrfZYUDrcW4aeI2+zemR/JB+rz5SL+kYvwQXQsDmWUr4qtRQPP+0L/keg7S1hmrZiW3J1P7C1ps8bdCGHFZ0UV29kXmc/xCU8zk9J1E7vkxWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790145815; c=relaxed/simple; bh=xR1/NeQX09LWnchhSJVuQ4BnNu/6StOlNDyMewUEQSI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JFPkQpcfYKNEj6pot9t1B2P+iHS3OIHm86Nihpd82CYIzGIMswBB5XcoG1errWxEwXTwu7v/o6nnSgMtbu18B5uJBZT7FyykatEFREY6IAyHYmEEBl63HL5huu7uvaj0oPZvUgBtumGqZJQPSF5+Srp1ybfpTBPUxkmjSxKeljw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YaLM412a; arc=none smtp.client-ip=74.125.227.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YaLM412a" Received: by mail-pj2-f12.google.com with SMTP id d9443c01a7336-2d6ff2f2c4eso1292535ad.1 for ; Tue, 22 Sep 2026 23:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790145807; x=1790750607; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=FQdfqiVzHOdi7EyeynQ0dghVkDzzyRlpExwCwSwjPJw=; b=YaLM412a/JQIxO5NQM3h0M9A+YSeGws8quxmpM+0heun6ScE/o9z4hdL8ftXQXjjsR 6LgDcMhlYxc7Bv9upgmAbGscjwaaRojGRAtu2CzW/IAk8WDiA8PcK2SDDRbh9zRLjTM0 EjTRzvTouq7TikSkxa1jdC+NvBNqlY7ztMnDB2PBETw2846FstH+fCqpn3Dq/KWVjG0c weHaX+eHQQhg/+GourQ187dlul4ZjCmvT2b+b/3a9BO3q+CcwPr8Mc9enQ+zFebX90wo A8O+7zEONZfw13VDHxWrY6kOh/sSxNrTqL2GB2orSsFVvcWV0OcjgLlFOEHxBiKlB4pt K4ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790145807; x=1790750607; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FQdfqiVzHOdi7EyeynQ0dghVkDzzyRlpExwCwSwjPJw=; b=MdKQY1Z7W7gu5qWl0dz0RZBVSqrO4PxNqv1+pLDDqJtV0oi6RpUh4Oo5xcOwVEN7ZK gMZQxj0cBw1TFasX/flUTvPrL2u+mPN8/8KKzMcnDlf4tmhHxdV7nukuXmdyk834L+jp uncwRrBpW7UgKderFsBiA7UmDXEcmcqTwiOfensdtZLPfyV+yuyAI+NvuzqT8DJK3ds2 v+g0picGUoM8u5dIJt64KV6zo+fe9IzmFGejWKjUVYXz2IBnhm3Q29niO/q+rN1F7ktU gGdlqNX6oxBUS+3ydw1iF13ZQa3XuEjnV6CFRoUj/CTnP8P5mDzmXpmyDvJvGv5yZsO2 RDDQ== X-Forwarded-Encrypted: i=1; AKwUvBypNJ2r3VQBxGOobh5xLX0HPN2CR2zXBQCnSAFP1dxaDk3AqPanr2bWDhxwniMB3mNIed/5sO494g==@vger.kernel.org X-Gm-Message-State: AFuF++kBl/y1b6k5g8DDMrBaiEUOC3D0oq84Ubzzq3Gf2SxUr/T4xdsC Of2mYVggch6e9E26OasqB7AOM8En8IMyPK4I9BY1BQCzeXgphXnuIo++uGZZvETqzT8= X-Gm-Gg: AYBFou07dJNu4dkrOgFD++u1V2v8MzMtokYbPvWtLPimomCQeyy/xF8xq/0mIuQIn02 fZ6M5bpfk43pmCblXm0lVxPu4rKNUTr1Z5J4JJp5H4QmKOkYwWllEFj866JKHrbj3Nxp2bAfaRH lxam37xlemNa8MrcFabqqIBjF+y9c/XJu57jbKDSiYvIyvUV7PLGDKC5HoaPx4TDi+R1WMmhJNd PgBV5SDeaSbzIZn9oV2ZtcUjmrarKs1QtbBwWuBcVxZzocBKpUtTo7H8/FFcAtnFsnbIfNI+oS2 cZDbsecAYQXaRNwZg2f/NpMBQveGfhUp8gc4XvDBPugaT71SF+GNEUS0aEXTcAy6TbHUDjC67jT UcRIPwz6krC+au/sJEb0C2AoE1qdLt9j9zn6NWMoQL1rXgAAgAiujfOMsM6baNpcyuNdCnpQNoz 2Y5puwyzi+eZme9yACB9EvblpbPvEStO0snyS6D9RtvyWkjGAhwEEuINMK+xN7aANg1g== X-Received: by 2002:a17:90b:564d:b0:39e:4546:fb1e with SMTP id 98e67ed59e1d1-3a07e7e4d13mr2618891a91.4.1790145807481; Tue, 22 Sep 2026 23:43:27 -0700 (PDT) Received: from archlinux ([138.199.21.232]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3a07dc32086sm3227338a91.13.2026.09.22.23.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 23:43:27 -0700 (PDT) From: Chen Xiaokun 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 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 Message-ID: <20260923064315.195997-1-shinnkka1@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [ 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 --- 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