linux/drivers/mmc/core
Matt Fleming e881279363 sdio: initialise SDIO functions and update card->sdio_funcs in lockstep
Daniel Drake noticed a crash in the error path of mmc_attach_sdio().  This
bug is discussed at http://dev.laptop.org/ticket/9707.

BUG: unable to handle kernel paging request at 6b6b6c57
IP: [<b066d6e2>] sdio_remove_func+0x9/0x27
Call Trace:
[<b066cfb4>] ? mmc_sdio_remove+0x34/0x65
[<b066d1fc>] ? mmc_attach_sdio+0x217/0x240
[<b066a22f>] ? mmc_rescan+0x1a2/0x20f
[<b042e9a0>] ? worker_thread+0x156/0x1e

We need to accurately track how many SDIO functions have been initialised
(and keep card->sdio_funcs in sync) so that we don't try to remove more
functions than we initialised if we hit the error path in
mmc_attach_sdio().

Without this patch if we hit the error path in mmc_attach_sdio() we run
the risk of deferencing invalid memory in sdio_remove_func(), leading to a
crash.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Cc: Daniel Drake <dsd@laptop.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-17 15:45:31 -08:00
..
bus.c mmc: add MODALIAS linkage for MMC/SD devices 2009-03-24 21:29:58 +01:00
bus.h mmc: use sysfs groups to handle conditional attributes 2008-03-22 17:02:20 -07:00
core.c mmc: add module parameter to set whether cards are assumed removable 2009-12-15 08:53:35 -08:00
core.h mmc: add module parameter to set whether cards are assumed removable 2009-12-15 08:53:35 -08:00
debugfs.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
host.c mmc: add 'enable' and 'disable' methods to mmc host 2009-09-23 07:39:33 -07:00
host.h mmc: add 'enable' and 'disable' methods to mmc host 2009-09-23 07:39:33 -07:00
Kconfig mmc: add module parameter to set whether cards are assumed removable 2009-12-15 08:53:35 -08:00
Makefile mmc: Export internal host state through debugfs 2008-07-27 01:26:16 +02:00
mmc_ops.c mmc: check status after MMC SWITCH command 2009-09-23 07:39:34 -07:00
mmc_ops.h mmc: add mmc card sleep and awake support 2009-09-23 07:39:33 -07:00
mmc.c mmc: add module parameter to set whether cards are assumed removable 2009-12-15 08:53:35 -08:00
sd_ops.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
sd_ops.h drivers/mmc/core/: make 3 functions static 2007-07-26 02:05:57 +02:00
sd.c mmc: add module parameter to set whether cards are assumed removable 2009-12-15 08:53:35 -08:00
sdio_bus.c sdio: fix reference counting in sdio_remove_func() 2009-12-17 15:45:31 -08:00
sdio_bus.h mmc: basic SDIO device model 2007-09-23 19:45:31 +02:00
sdio_cis.c sdio: rework cis tuple parsing 2009-12-15 08:53:34 -08:00
sdio_cis.h sdio: split up common and function CIS parsing 2007-09-23 20:44:22 +02:00
sdio_io.c sdio: add MMC_QUIRK_LENIENT_FN0 2009-09-23 07:39:37 -07:00
sdio_irq.c sdio: give sdio irq thread a host specific name 2008-10-12 11:04:30 +02:00
sdio_ops.c sdio: check that addresses are within the address space 2009-03-24 21:30:00 +01:00
sdio_ops.h sdio: extend sdio_readsb() and friends to handle any length of buffer 2007-09-23 21:21:32 +02:00
sdio.c sdio: initialise SDIO functions and update card->sdio_funcs in lockstep 2009-12-17 15:45:31 -08:00