MMC core:

- Fix support for SD Power off notification
 
 MMC host:
  - moxart: Fix potential use-after-free on remove path
  - sdhci-of-esdhc: Fix error path when setting dma mask
  - sh_mmcif: Fix potential NULL pointer dereference
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmIBAQ4XHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCklMhAAh/81L76M6NTNPK02drTPxLtG
 PKuzh0yoI2in4bUFTFsDL8HxHaifnKZeGlZk4yNxF68zgvHNFh/YdNklayLwhJyg
 sOW+eg+2hcz8167QBIwLlLqW8UFePpTIeXNOMnRtds7bOCazsiSU9GI2kM3+dERv
 qIKwakJep8ROBXqfH8y+MkioVju5N3L+mM1pDunbkmAkM68BtregqG74LDEEqmYN
 etlCbVbN5rNgQqOydMnctv9f2FnTnJUQp7ntJv7jH+aZ3O4b1kfxVFJlcoDcMQ/S
 3DcQqT7G7jx2hLXKQ3jMQkDNOGWa+81rg20d6o78gXrICICVS4zxjISgD22Ft55H
 QJyjzXUwzODwiVrI/sKZ73yw8VTdKUEThhnxIE0VpCI/3GGZ4l4aL2e77MOnHMDw
 LQqtHj3HBCYOTOk6lxUw1wLl4YJ7ACp6LTX70g5zKeRVCXG6L5i3qozHmnWVMRko
 +PLMvqBFfs521X6lB4NVLMNd4z1EkJOjJxlyopd9CgWAANKS38Hgk+H7hH+IRHq3
 /xmjKwmOJ9KGe3wjiUI5Lx6UD/x/Hix1/kHZvErhdZVXRNuS1y5pxdNRCkmjys8e
 cuMVc4P0g+f8O0KUvn9EqCipBPXGMeqMj1EmDuWM5HJyeNIYi14mB1P9BuHgOjUX
 DqOt3wIOQ6/qn5WziRU=
 =AGT6
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Fix support for SD Power off notification

  MMC host:
   - moxart: Fix potential use-after-free on remove path
   - sdhci-of-esdhc: Fix error path when setting dma mask
   - sh_mmcif: Fix potential NULL pointer dereference"

* tag 'mmc-v5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  moxart: fix potential use-after-free on remove path
  mmc: core: Wait for command setting 'Power Off Notification' bit to complete
  mmc: sh_mmcif: Check for null res pointer
  mmc: sdhci-of-esdhc: Check for error num after setting mask
This commit is contained in:
Linus Torvalds 2022-02-07 11:51:14 -08:00
commit 51f7ea914d
4 changed files with 17 additions and 4 deletions

View File

@ -67,7 +67,7 @@ static const unsigned int sd_au_size[] = {
__res & __mask; \
})
#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 2000
#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 1000
#define SD_WRITE_EXTR_SINGLE_TIMEOUT_MS 1000
struct sd_busy_data {
@ -1664,6 +1664,12 @@ static int sd_poweroff_notify(struct mmc_card *card)
goto out;
}
/* Find out when the command is completed. */
err = mmc_poll_for_busy(card, SD_WRITE_EXTR_SINGLE_TIMEOUT_MS, false,
MMC_BUSY_EXTR_SINGLE);
if (err)
goto out;
cb_data.card = card;
cb_data.reg_buf = reg_buf;
err = __mmc_poll_for_busy(card->host, SD_POWEROFF_NOTIFY_TIMEOUT_MS,

View File

@ -705,12 +705,12 @@ static int moxart_remove(struct platform_device *pdev)
if (!IS_ERR_OR_NULL(host->dma_chan_rx))
dma_release_channel(host->dma_chan_rx);
mmc_remove_host(mmc);
mmc_free_host(mmc);
writel(0, host->base + REG_INTERRUPT_MASK);
writel(0, host->base + REG_POWER_CONTROL);
writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
host->base + REG_CLOCK_CONTROL);
mmc_free_host(mmc);
return 0;
}

View File

@ -524,12 +524,16 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
static int esdhc_of_enable_dma(struct sdhci_host *host)
{
int ret;
u32 value;
struct device *dev = mmc_dev(host->mmc);
if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") ||
of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc"))
dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) {
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
if (ret)
return ret;
}
value = sdhci_readl(host, ESDHC_DMA_SYSCTL);

View File

@ -405,6 +405,9 @@ static int sh_mmcif_dma_slave_config(struct sh_mmcif_host *host,
struct dma_slave_config cfg = { 0, };
res = platform_get_resource(host->pd, IORESOURCE_MEM, 0);
if (!res)
return -EINVAL;
cfg.direction = direction;
if (direction == DMA_DEV_TO_MEM) {