From: Ho Jie Feng <hjf3108@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
Alex Dubov <oakad@yahoo.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Ho Jie Feng <hjf3108@gmail.com>, Omar Sandoval <osandov@fb.com>,
Hannes Reinecke <hare@suse.com>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/5] memstick: mspro_block: don't hand a finished request back to the host
Date: Mon, 9 Nov 2026 23:38:00 +0800 [thread overview]
Message-ID: <20261109153832.7377-1-hjf3108@gmail.com> (raw)
In-Reply-To: <20261109153510.7161-1-hjf3108@gmail.com>
When a block request ends, mspro_block_complete_req() clears
msb->block_req, completes card->mrq_complete and returns 0.
Host drivers take a 0 return from memstick_next_req() to mean that
*mrq holds a new request, so the host issues card->current_mrq again
even though it has already finished.
At the same time, msb->block_req being NULL allows mspro_queue_rq() to
pass the check and queue another request, causing a race condition
that rewrites card->current_mrq while the host is executing it.
Return -EAGAIN instead, as the function already does when there is no
block request.
Fixes: d0be12274dad ("mspro_block: convert to blk-mq")
Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
---
drivers/memstick/core/mspro_block.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 4a52830026c50..fe38b42431219 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -706,6 +706,8 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
__blk_mq_end_request(msb->block_req,
errno_to_blk_status(error));
msb->block_req = NULL;
+ if (!error)
+ error = -EAGAIN;
}
} else {
if (!error)
--
2.56.0
next prev parent reply other threads:[~2026-11-09 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:34 [PATCH 0/5] memstick: fixes for mspro_block and ms_block Ho Jie Feng
2026-11-09 15:38 ` Ho Jie Feng [this message]
2026-11-09 15:38 ` [PATCH 2/5] memstick: mspro_block: wait for running dispatches in mspro_block_stop() Ho Jie Feng
2026-11-09 15:38 ` [PATCH 3/5] memstick: ms_block: don't erase the old block of an unmapped LBA Ho Jie Feng
2026-11-09 15:38 ` [PATCH 4/5] memstick: ms_block: keep the power off during a full msb_reset() Ho Jie Feng
2026-11-09 15:38 ` [PATCH 5/5] memstick: ms_block: add the missing newline to the parallel switch error Ho Jie Feng
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=20261109153832.7377-1-hjf3108@gmail.com \
--to=hjf3108@gmail.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=oakad@yahoo.com \
--cc=osandov@fb.com \
--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
all inboxes | Powered by JetHome®