Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Guangshuo Li <lgs201920130244@gmail.com>
To: Maxim Levitsky <maximlevitsky@gmail.com>,
	Alex Dubov <oakad@yahoo.com>, Ulf Hansson <ulfh@kernel.org>,
	Kees Cook <kees@kernel.org>, Maoyi Xie <maoyixie.tju@gmail.com>,
	Guangshuo Li <lgs201920130244@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH] memstick: ms_block: destroy io_queue workqueue on removal
Date: Tue, 15 Sep 2026 23:03:17 +0800	[thread overview]
Message-ID: <20260915150317.2444609-1-lgs201920130244@gmail.com> (raw)

msb_init_disk() allocates msb->io_queue with alloc_ordered_workqueue(),
while msb_remove() does not destroy the workqueue.

The probe failure path releases the workqueue with destroy_workqueue(),
but the normal removal path only flushes it through msb_stop(). Flushing
a workqueue does not release the workqueue itself, so each card
insert/remove cycle leaks the workqueue and its worker.

Destroy io_queue during removal after the outstanding work has been
drained.

Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/memstick/core/ms_block.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index ce33907bfc24..65154e569a9e 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -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);
 }
-- 
2.43.0


             reply	other threads:[~2026-09-15 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 15:03 Guangshuo Li [this message]
2026-09-28 16:13 ` [PATCH] memstick: ms_block: destroy io_queue workqueue on removal Ulf Hansson
  -- strict thread matches above, loose matches on Subject: below --
2026-08-04 21:34 Yifei Gao
2026-09-04  9:41 ` Ulf Hansson

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=20260915150317.2444609-1-lgs201920130244@gmail.com \
    --to=lgs201920130244@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=maximlevitsky@gmail.com \
    --cc=oakad@yahoo.com \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@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