Skip to content

Commit 01f5bbd

Browse files
ahunter6storulf
authored andcommitted
mmc: block: Fix incorrectly initialized requests
mmc_init_request() depends on card->bouncesz so it must be calculated before blk_init_allocated_queue() starts allocating requests. Reported-by: Seraphime Kirkovski <[email protected]> Fixes: 304419d ("mmc: core: Allocate per-request data using the..") Signed-off-by: Adrian Hunter <[email protected]> Tested-by: Seraphime Kirkovski <[email protected]> Cc: <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Tested-by: Pavel Machek <[email protected]>
1 parent c16a854 commit 01f5bbd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/mmc/core/queue.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
242242
if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
243243
limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
244244

245+
/*
246+
* mmc_init_request() depends on card->bouncesz so it must be calculated
247+
* before blk_init_allocated_queue() starts allocating requests.
248+
*/
249+
card->bouncesz = mmc_queue_calc_bouncesz(host);
250+
245251
mq->card = card;
246252
mq->queue = blk_alloc_queue(GFP_KERNEL);
247253
if (!mq->queue)
@@ -265,7 +271,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
265271
if (mmc_can_erase(card))
266272
mmc_queue_setup_discard(mq->queue, card);
267273

268-
card->bouncesz = mmc_queue_calc_bouncesz(host);
269274
if (card->bouncesz) {
270275
blk_queue_max_hw_sectors(mq->queue, card->bouncesz / 512);
271276
blk_queue_max_segments(mq->queue, card->bouncesz / 512);

0 commit comments

Comments
 (0)