linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free()
@ 2015-02-18 16:34 Geert Uytterhoeven
  2015-03-05 10:08 ` Geert Uytterhoeven
  2015-03-05 13:41 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-02-18 16:34 UTC (permalink / raw)
  To: Kuninori Morimoto, Ian Molton, Chris Ball, Ulf Hansson
  Cc: linux-mmc, linux-sh, linux-kernel, Geert Uytterhoeven

If CONFIG_DEBUG_SLAB=y:

    sh_mobile_sdhi ee100000.sd: Got CD GPIO
    sh_mobile_sdhi ee100000.sd: Got WP GPIO
    platform ee100000.sd: Driver sh_mobile_sdhi requests probe deferral
    ...
    Slab corruption (Not tainted): kmalloc-1024 start=ed8b3c00, len=1024
    2d0: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  ....kkkkkkkkkkkk
    Prev obj: start=ed8b3800, len=1024
    000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk

Struct tmio_mmc_host is embedded inside struct mmc_host, and thus is
freed by the call to mmc_free_host(). Hence it must not be written to
afterwards, as that will corrupt freed (and perhaps already reused)
memory.

Fixes: 94b110aff8679b14 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/mmc/host/tmio_mmc_pio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index a31c3573d386f8c6..dba7e1c19dd758e7 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1073,8 +1073,6 @@ EXPORT_SYMBOL(tmio_mmc_host_alloc);
 void tmio_mmc_host_free(struct tmio_mmc_host *host)
 {
 	mmc_free_host(host->mmc);
-
-	host->mmc = NULL;
 }
 EXPORT_SYMBOL(tmio_mmc_host_free);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free()
  2015-02-18 16:34 [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free() Geert Uytterhoeven
@ 2015-03-05 10:08 ` Geert Uytterhoeven
  2015-03-05 13:41 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-03-05 10:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kuninori Morimoto, Ian Molton, Chris Ball, Ulf Hansson,
	Linux MMC List, Linux-sh list, linux-kernel

Ping?

On Wed, Feb 18, 2015 at 5:34 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> If CONFIG_DEBUG_SLAB=y:
>
>     sh_mobile_sdhi ee100000.sd: Got CD GPIO
>     sh_mobile_sdhi ee100000.sd: Got WP GPIO
>     platform ee100000.sd: Driver sh_mobile_sdhi requests probe deferral
>     ...
>     Slab corruption (Not tainted): kmalloc-1024 start=ed8b3c00, len=1024
>     2d0: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  ....kkkkkkkkkkkk
>     Prev obj: start=ed8b3800, len=1024
>     000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
>     010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
>
> Struct tmio_mmc_host is embedded inside struct mmc_host, and thus is
> freed by the call to mmc_free_host(). Hence it must not be written to
> afterwards, as that will corrupt freed (and perhaps already reused)
> memory.
>
> Fixes: 94b110aff8679b14 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index a31c3573d386f8c6..dba7e1c19dd758e7 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1073,8 +1073,6 @@ EXPORT_SYMBOL(tmio_mmc_host_alloc);
>  void tmio_mmc_host_free(struct tmio_mmc_host *host)
>  {
>         mmc_free_host(host->mmc);
> -
> -       host->mmc = NULL;
>  }
>  EXPORT_SYMBOL(tmio_mmc_host_free);
>
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free()
  2015-02-18 16:34 [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free() Geert Uytterhoeven
  2015-03-05 10:08 ` Geert Uytterhoeven
@ 2015-03-05 13:41 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2015-03-05 13:41 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kuninori Morimoto, Ian Molton, Chris Ball, linux-mmc,
	Linux-sh list, linux-kernel

On 18 February 2015 at 17:34, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> If CONFIG_DEBUG_SLAB=y:
>
>     sh_mobile_sdhi ee100000.sd: Got CD GPIO
>     sh_mobile_sdhi ee100000.sd: Got WP GPIO
>     platform ee100000.sd: Driver sh_mobile_sdhi requests probe deferral
>     ...
>     Slab corruption (Not tainted): kmalloc-1024 start=ed8b3c00, len=1024
>     2d0: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  ....kkkkkkkkkkkk
>     Prev obj: start=ed8b3800, len=1024
>     000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
>     010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
>
> Struct tmio_mmc_host is embedded inside struct mmc_host, and thus is
> freed by the call to mmc_free_host(). Hence it must not be written to
> afterwards, as that will corrupt freed (and perhaps already reused)
> memory.
>
> Fixes: 94b110aff8679b14 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Applied, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/host/tmio_mmc_pio.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index a31c3573d386f8c6..dba7e1c19dd758e7 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1073,8 +1073,6 @@ EXPORT_SYMBOL(tmio_mmc_host_alloc);
>  void tmio_mmc_host_free(struct tmio_mmc_host *host)
>  {
>         mmc_free_host(host->mmc);
> -
> -       host->mmc = NULL;
>  }
>  EXPORT_SYMBOL(tmio_mmc_host_free);
>
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-05 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 16:34 [PATCH] mmc: tmio: Remove bogus un-initialization in tmio_mmc_host_free() Geert Uytterhoeven
2015-03-05 10:08 ` Geert Uytterhoeven
2015-03-05 13:41 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).