Skip to content

Commit ebb2c24

Browse files
committed
Merge tag 'mmc-v4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix trivial typo in Kconfig - Fixup initialization of mmc block requests MMC host: - cavium: Fix use-after-free bug reported by KASAN" * tag 'mmc-v4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: cavium: Fix use-after-free in of_platform_device_destroy mmc: host: fix typo after MMC_DEBUG move mmc: block: Fix incorrectly initialized requests
2 parents 0666f56 + b917c6d commit ebb2c24

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
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);

drivers/mmc/host/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
comment "MMC/SD/SDIO Host Controller Drivers"
66

77
config MMC_DEBUG
8-
bool "MMC host drivers debugginG"
8+
bool "MMC host drivers debugging"
99
depends on MMC != n
1010
help
1111
This is an option for use by developers; most people should

drivers/mmc/host/cavium-thunderx.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* Copyright (C) 2016 Cavium Inc.
99
*/
10+
#include <linux/device.h>
1011
#include <linux/dma-mapping.h>
1112
#include <linux/interrupt.h>
1213
#include <linux/mmc/mmc.h>
@@ -149,8 +150,11 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
149150
for (i = 0; i < CAVIUM_MAX_MMC; i++) {
150151
if (host->slot[i])
151152
cvm_mmc_of_slot_remove(host->slot[i]);
152-
if (host->slot_pdev[i])
153+
if (host->slot_pdev[i]) {
154+
get_device(&host->slot_pdev[i]->dev);
153155
of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
156+
put_device(&host->slot_pdev[i]->dev);
157+
}
154158
}
155159
clk_disable_unprepare(host->clk);
156160
return ret;

0 commit comments

Comments
 (0)