FAILED: patch "[PATCH] memstick: ms_block: destroy io_queue workqueue on removal" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 90af7fde083e1b22c349c3a8b1626728e44e474c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092240-eel-composure-463d@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 90af7fde083e1b22c349c3a8b1626728e44e474c Mon Sep 17 00:00:00 2001
From: Yifei Gao <[email protected]>
Date: Tue, 4 Aug 2026 21:34:56 +0000
Subject: [PATCH] memstick: ms_block: destroy io_queue workqueue on removal
msb_init_disk() creates the per-card ordered workqueue msb->io_queue with alloc_ordered_workqueue(). It is torn down with destroy_workqueue() only on the init error path; msb_remove() never destroys it. msb_stop() merely flushes the queue, and neither msb_data_clear() nor put_disk() free it. As a result every card insert/remove cycle leaks the workqueue and its kworker, exhausting kernel memory over repeated cycles.
Destroy the workqueue in msb_remove() after the disk has been removed and the queue drained.
drivers/memstick/core/ms_block.c +2 -0
@@ -2204,6 +2204,8 @@ static void msb_remove(struct memstick_dev *card)msb_data_clear (msb);mutex_unlock (&msb_disk_lock); +destroy_workqueue (msb->io_queue); +put_disk (msb->disk);memstick_set_drvdata (card,NULL ); }
Sasha Levin
maintainerPATCH 1/1 memstick: ms_block: destroy io_queue workqueue on removal
From: Yifei Gao <[email protected]>
[ Upstream commit 90af7fde083e1b22c349c3a8b1626728e44e474c ]
msb_init_disk() creates the per-card ordered workqueue msb->io_queue with alloc_ordered_workqueue(). It is torn down with destroy_workqueue() only on the init error path; msb_remove() never destroys it. msb_stop() merely flushes the queue, and neither msb_data_clear() nor put_disk() free it. As a result every card insert/remove cycle leaks the workqueue and its kworker, exhausting kernel memory over repeated cycles.
Destroy the workqueue in msb_remove() after the disk has been removed and the queue drained.
--- drivers/memstick/core/ms_block.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/memstick/core/ms_block.c +2 -0
@@ -2226,6 +2226,8 @@ static void msb_remove(struct memstick_dev *card)msb_data_clear (msb);mutex_unlock (&msb_disk_lock); +destroy_workqueue (msb->io_queue); +msb_disk_release (msb->disk);memstick_set_drvdata (card,NULL ); }
Signature · 1 line
2.53.0