* [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks
@ 2022-04-01 14:09 Geert Uytterhoeven
2022-04-01 16:01 ` Wolfram Sang
2022-04-04 11:52 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-04-01 14:09 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson
Cc: linux-mmc, linux-renesas-soc, Geert Uytterhoeven
When running on an system without any quirks (e.g. R-Car V3U), the
kernel crashes with a NULL pointer dereference:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000002
...
Hardware name: Renesas Falcon CPU and Breakout boards based on r8a779a0 (DT)
Workqueue: events_freezable mmc_rescan
...
Call trace:
renesas_sdhi_internal_dmac_start_dma+0x54/0x12c
tmio_process_mrq+0x124/0x274
Fix this by adding the missing checks for the validatity of the
priv->quirks pointer.
Fixes: dce2ba8b2ee8cef6 ("mmc: renesas_sdhi: make 'dmac_only_one_rx' a quirk")
Fixes: d4bfa17a655c6de2 ("mmc: renesas_sdhi: make 'fixed_addr_mode' a quirk")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 6dd5ade3851b2ba8..90048f74e6221add 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -374,7 +374,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
struct scatterlist *sg = host->sg_ptr;
u32 dtran_mode = DTRAN_MODE_BUS_WIDTH;
- if (!priv->quirks->fixed_addr_mode)
+ if (!(priv->quirks && priv->quirks->fixed_addr_mode))
dtran_mode |= DTRAN_MODE_ADDR_MODE;
if (!renesas_sdhi_internal_dmac_map(host, data, COOKIE_MAPPED))
@@ -382,7 +382,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
if (data->flags & MMC_DATA_READ) {
dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
- if (priv->quirks->dma_one_rx_only &&
+ if (priv->quirks && priv->quirks->dma_one_rx_only &&
test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags))
goto force_pio_with_unmap;
} else {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks
2022-04-01 14:09 [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks Geert Uytterhoeven
@ 2022-04-01 16:01 ` Wolfram Sang
2022-04-04 11:52 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-04-01 16:01 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Ulf Hansson, linux-mmc, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
On Fri, Apr 01, 2022 at 04:09:28PM +0200, Geert Uytterhoeven wrote:
> When running on an system without any quirks (e.g. R-Car V3U), the
> kernel crashes with a NULL pointer dereference:
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000002
> ...
> Hardware name: Renesas Falcon CPU and Breakout boards based on r8a779a0 (DT)
> Workqueue: events_freezable mmc_rescan
> ...
> Call trace:
> renesas_sdhi_internal_dmac_start_dma+0x54/0x12c
> tmio_process_mrq+0x124/0x274
>
> Fix this by adding the missing checks for the validatity of the
> priv->quirks pointer.
>
> Fixes: dce2ba8b2ee8cef6 ("mmc: renesas_sdhi: make 'dmac_only_one_rx' a quirk")
> Fixes: d4bfa17a655c6de2 ("mmc: renesas_sdhi: make 'fixed_addr_mode' a quirk")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks for catching this!
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks
2022-04-01 14:09 [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks Geert Uytterhoeven
2022-04-01 16:01 ` Wolfram Sang
@ 2022-04-04 11:52 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-04-04 11:52 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Wolfram Sang, linux-mmc, linux-renesas-soc
On Fri, 1 Apr 2022 at 16:09, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> When running on an system without any quirks (e.g. R-Car V3U), the
> kernel crashes with a NULL pointer dereference:
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000002
> ...
> Hardware name: Renesas Falcon CPU and Breakout boards based on r8a779a0 (DT)
> Workqueue: events_freezable mmc_rescan
> ...
> Call trace:
> renesas_sdhi_internal_dmac_start_dma+0x54/0x12c
> tmio_process_mrq+0x124/0x274
>
> Fix this by adding the missing checks for the validatity of the
> priv->quirks pointer.
>
> Fixes: dce2ba8b2ee8cef6 ("mmc: renesas_sdhi: make 'dmac_only_one_rx' a quirk")
> Fixes: d4bfa17a655c6de2 ("mmc: renesas_sdhi: make 'fixed_addr_mode' a quirk")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/renesas_sdhi_internal_dmac.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index 6dd5ade3851b2ba8..90048f74e6221add 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -374,7 +374,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
> struct scatterlist *sg = host->sg_ptr;
> u32 dtran_mode = DTRAN_MODE_BUS_WIDTH;
>
> - if (!priv->quirks->fixed_addr_mode)
> + if (!(priv->quirks && priv->quirks->fixed_addr_mode))
> dtran_mode |= DTRAN_MODE_ADDR_MODE;
>
> if (!renesas_sdhi_internal_dmac_map(host, data, COOKIE_MAPPED))
> @@ -382,7 +382,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
>
> if (data->flags & MMC_DATA_READ) {
> dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
> - if (priv->quirks->dma_one_rx_only &&
> + if (priv->quirks && priv->quirks->dma_one_rx_only &&
> test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags))
> goto force_pio_with_unmap;
> } else {
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-04 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 14:09 [PATCH] mmc: renesas_sdhi: Add missing checks for the presence of quirks Geert Uytterhoeven
2022-04-01 16:01 ` Wolfram Sang
2022-04-04 11:52 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox