Re: [PATCH 2/2] mmc: renesas_sdhi: fix kernel panic in _internal_dmac.c

Geert Uytterhoeven
2017-10-17T08:11:16Z

Hi Shimoda-san,

On Tue, Oct 17, 2017 at 9:30 AM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Since this driver checks if the return value of dma_map_sg() is minus
> or not and keeps to enable the DMAC, it may cause kernel panic when
> the dma_map_sg() returns 0. So, this patch fixes the issue.

Thanks for your patch!

Indeed:

* dma_maps_sg_attrs returns 0 on error and > 0 on success.
* It should never return a value < 0.

A quick grep shows there are 4 more offenders:

- drivers/crypto/qce/ablkcipher.c
- drivers/crypto/qce/sha.c
- drivers/hsi/controllers/omap_ssi_port.c
- drivers/mailbox/bcm-flexrm-mailbox.c

> Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
> Fixes: 2a68ea7896e3 ("mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds