linux-uconsole/drivers
Andreas Bießmann ecd111b67d mtd: omap2: fix omap_nand_remove segfault
commit 7d9b110269 upstream.

Do not kfree() the mtd_info; it is handled in the mtd subsystem and
already freed by nand_release(). Instead kfree() the struct
omap_nand_info allocated in omap_nand_probe which was not freed before.

This patch fixes following error when unloading the omap2 module:

---8<---
~ $ rmmod omap2
------------[ cut here ]------------
kernel BUG at mm/slab.c:3126!
Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
Modules linked in: omap2(-)
CPU: 0    Not tainted  (3.6.0-rc3-00230-g155e36d-dirty #3)
PC is at cache_free_debugcheck+0x2d4/0x36c
LR is at kfree+0xc8/0x2ac
pc : [<c01125a0>]    lr : [<c0112efc>]    psr: 200d0193
sp : c521fe08  ip : c0e8ef90  fp : c521fe5c
r10: bf0001fc  r9 : c521e000  r8 : c0d99c8c
r7 : c661ebc0  r6 : c065d5a4  r5 : c65c4060  r4 : c78005c0
r3 : 00000000  r2 : 00001000  r1 : c65c4000  r0 : 00000001
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 86694019  DAC: 00000015
Process rmmod (pid: 549, stack limit = 0xc521e2f0)
Stack: (0xc521fe08 to 0xc5220000)
fe00:                   c008a874 c00bf44c c515c6d0 200d0193 c65c4860 c515c240
fe20: c521fe3c c521fe30 c008a9c0 c008a854 c521fe5c c65c4860 c78005c0 bf0001fc
fe40: c780ff40 a00d0113 c521e000 00000000 c521fe84 c521fe60 c0112efc c01122d8
fe60: c65c4860 c0673778 c06737ac 00000000 00070013 00000000 c521fe9c c521fe88
fe80: bf0001fc c0112e40 c0673778 bf001ca8 c521feac c521fea0 c02ca11c bf0001ac
fea0: c521fec4 c521feb0 c02c82c4 c02ca100 c0673778 bf001ca8 c521fee4 c521fec8
fec0: c02c8dd8 c02c8250 00000000 bf001ca8 bf001ca8 c0804ee0 c521ff04 c521fee8
fee0: c02c804c c02c8d20 bf001924 00000000 bf001ca8 c521e000 c521ff1c c521ff08
ff00: c02c950c c02c7fbc bf001d48 00000000 c521ff2c c521ff20 c02ca3a4 c02c94b8
ff20: c521ff3c c521ff30 bf001938 c02ca394 c521ffa4 c521ff40 c009beb4 bf001930
ff40: c521ff6c 70616d6f b6fe0032 c0014f84 70616d6f b6fe0032 00000081 60070010
ff60: c521ff84 c521ff70 c008e1f4 c00bf328 0001a004 70616d6f c521ff94 0021ff88
ff80: c008e368 0001a004 70616d6f b6fe0032 00000081 c0015028 00000000 c521ffa8
ffa0: c0014dc0 c009bcd0 0001a004 70616d6f bec2ab38 00000880 bec2ab38 00000880
ffc0: 0001a004 70616d6f b6fe0032 00000081 00000319 00000000 b6fe1000 00000000
ffe0: bec2ab30 bec2ab20 00019f00 b6f539c0 60070010 bec2ab38 aaaaaaaa aaaaaaaa
Backtrace:
[<c01122cc>] (cache_free_debugcheck+0x0/0x36c) from [<c0112efc>] (kfree+0xc8/0x2ac)
[<c0112e34>] (kfree+0x0/0x2ac) from [<bf0001fc>] (omap_nand_remove+0x5c/0x64 [omap2])
[<bf0001a0>] (omap_nand_remove+0x0/0x64 [omap2]) from [<c02ca11c>] (platform_drv_remove+0x28/0x2c)
 r5:bf001ca8 r4:c0673778
[<c02ca0f4>] (platform_drv_remove+0x0/0x2c) from [<c02c82c4>] (__device_release_driver+0x80/0xdc)
[<c02c8244>] (__device_release_driver+0x0/0xdc) from [<c02c8dd8>] (driver_detach+0xc4/0xc8)
 r5:bf001ca8 r4:c0673778
[<c02c8d14>] (driver_detach+0x0/0xc8) from [<c02c804c>] (bus_remove_driver+0x9c/0x104)
 r6:c0804ee0 r5:bf001ca8 r4:bf001ca8 r3:00000000
[<c02c7fb0>] (bus_remove_driver+0x0/0x104) from [<c02c950c>] (driver_unregister+0x60/0x80)
 r6:c521e000 r5:bf001ca8 r4:00000000 r3:bf001924
[<c02c94ac>] (driver_unregister+0x0/0x80) from [<c02ca3a4>] (platform_driver_unregister+0x1c/0x20)
 r5:00000000 r4:bf001d48
[<c02ca388>] (platform_driver_unregister+0x0/0x20) from [<bf001938>] (omap_nand_driver_exit+0x14/0x1c [omap2])
[<bf001924>] (omap_nand_driver_exit+0x0/0x1c [omap2]) from [<c009beb4>] (sys_delete_module+0x1f0/0x2ec)
[<c009bcc4>] (sys_delete_module+0x0/0x2ec) from [<c0014dc0>] (ret_fast_syscall+0x0/0x48)
 r8:c0015028 r7:00000081 r6:b6fe0032 r5:70616d6f r4:0001a004
Code: e1a00005 eb0d9172 e7f001f2 e7f001f2 (e7f001f2)
---[ end trace 6a30b24d8c0cc2ee ]---
Segmentation fault
--->8---

This error was introduced in 67ce04bf27 which
was the first commit of this driver.

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-13 05:28:15 +09:00
..
accessibility
acpi ACPI: run _OSC after ACPI_FULL_INITIALIZATION 2012-10-13 05:28:03 +09:00
amba
ata libata: Prevent interface errors with Seagate FreeAgent GoFlex 2012-10-02 09:47:41 -07:00
atm solos-pci: Fix DMA support 2012-06-10 00:32:58 +09:00
auxdisplay
base PM / Runtime: Clear power.deferred_resume on success in rpm_suspend() 2012-10-02 09:47:40 -07:00
bcma
block aoe: assert AoE packets marked as requiring no checksum 2012-10-13 05:28:08 +09:00
bluetooth Bluetooth: Add support for Apple vendor-specific devices 2012-10-02 09:47:41 -07:00
cdrom cdrom: use copy_to_user() without the underscores 2012-02-29 16:34:35 -08:00
char TTY: ttyprintk, don't touch behind tty->write_buf 2012-10-07 08:27:25 -07:00
clk
clocksource
connector
cpufreq cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU 2012-10-02 09:47:22 -07:00
cpuidle
crypto crypto: mv_cesa requires on CRYPTO_HASH to build 2012-05-21 09:40:03 -07:00
dca
dio
dma dmaengine: at_hdmac: check that each sg data length is non-null 2012-10-02 09:47:37 -07:00
edac x86: Simplify code by removing a !SMP #ifdefs from 'struct cpuinfo_x86' 2012-08-15 12:04:09 -07:00
eisa
firewire firewire: ohci: fix too-early completion of IR multichannel buffers 2012-04-02 09:27:13 -07:00
firmware firmware: Add missing attributes to EFI variable attribute print out from sysfs 2012-10-07 08:27:25 -07:00
gpio pch_gpio: Support new device LAPIS Semiconductor ML7831 IOH 2012-05-21 09:40:05 -07:00
gpu drm/radeon: force MSIs on RS690 asics 2012-10-13 05:28:11 +09:00
hid HID: add more hotkeys in Asus AIO keyboards 2012-04-02 09:27:12 -07:00
hwmon hwmon: (ads7871) Add 'name' sysfs attribute 2012-10-02 09:47:26 -07:00
hwspinlock hwspinlock/core: use a mutex to protect the radix tree 2011-11-11 09:36:31 -08:00
i2c i2c: davinci: Free requested IRQ in remove 2012-06-01 15:13:01 +08:00
ide block: add and use scsi_blk_cmd_ioctl 2012-01-25 17:24:54 -08:00
idle intel_idle: fix API misuse 2012-01-25 17:24:56 -08:00
ieee802154
infiniband IB/srp: Avoid having aborted requests hang 2012-10-07 08:27:27 -07:00
input Input: i8042 - disable mux on Toshiba C850D 2012-10-02 09:47:27 -07:00
isdn isdnloop: fix and simplify isdnloop_init() 2012-10-02 09:47:05 -07:00
leds Revert "leds: save the delay values after a successful call to blink_set()" 2011-11-21 14:31:19 -08:00
lguest
macintosh
mca
md dm: handle requests beyond end of device instead of using BUG_ON 2012-10-07 08:27:23 -07:00
media media: rc: ite-cir: Initialise ite_dev::rdev earlier 2012-10-13 05:28:02 +09:00
memstick
message
mfd ARM: pxa: remove irq_to_gpio from ezx-pcap driver 2012-08-15 12:04:30 -07:00
misc drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources 2012-10-02 09:47:40 -07:00
mmc mmc: Prevent 1.8V switch for SD hosts that don't support UHS modes. 2012-10-02 09:47:54 -07:00
mtd mtd: omap2: fix omap_nand_remove segfault 2012-10-13 05:28:15 +09:00
net r8169: call netif_napi_del at errpaths and at driver unload 2012-10-13 05:28:14 +09:00
nfc
nubus
of
oprofile oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array 2012-07-16 08:47:48 -07:00
parisc
parport
pci PCI: Check P2P bridge for invalid secondary/subordinate range 2012-10-13 05:28:09 +09:00
pcmcia pcmcia: fix socket refcount decrementing on each resume 2012-02-13 11:06:10 -08:00
platform asus-nb-wmi: add some video toggle keys 2012-10-02 09:47:40 -07:00
pnp PNPACPI: Fix device ref leaking in acpi_pnp_match 2012-04-13 08:14:05 -07:00
power drivers/power/ds2780_battery.c: fix deadlock upon insertion and removal 2011-11-11 09:36:32 -08:00
pps
ps3
ptp ptp: Fix clock_getres() implementation 2011-12-21 12:57:36 -08:00
rapidio rapidio: fix use of non-compatible registers 2011-10-03 11:39:46 -07:00
regulator regulator: Fix the logic to ensure new voltage setting in valid range 2012-05-21 09:39:58 -07:00
rtc drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode 2012-10-02 09:47:39 -07:00
s390 SCSI: zfcp: only access zfcp_scsi_dev for valid scsi_device 2012-10-13 05:28:09 +09:00
sbus
scsi drivers/scsi/atp870u.c: fix bad use of udelay 2012-10-13 05:28:03 +09:00
sfi
sh
sn
spi spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control 2012-10-02 09:47:54 -07:00
ssb ssb: fix init regression with SoCs 2012-01-06 14:13:48 -08:00
staging staging: comedi: fix memory leak for saved channel list 2012-10-07 08:27:24 -07:00
target target: Fix ->data_length re-assignment bug with SCSI overflow 2012-10-02 09:47:23 -07:00
tc
telephony
thermal
tty n_gsm: memory leak in uplink error path 2012-10-07 08:27:26 -07:00
uio
usb Increase XHCI suspend timeout to 16ms 2012-10-07 08:27:26 -07:00
uwb uwb: fix error handling 2012-04-27 09:51:06 -07:00
vhost vhost: don't forget to schedule() 2012-07-16 08:47:51 -07:00
video fbcon: fix race condition between console lock and cursor timer (v1.1) 2012-10-02 09:47:40 -07:00
virtio virtio-pci: fix use after free 2011-11-21 14:31:14 -08:00
vlynq
w1 drivers/power/ds2780_battery.c: add a nolock function to w1 interface 2011-11-11 09:36:32 -08:00
watchdog hpwdt: Fix kdump issue in hpwdt 2012-10-02 09:47:27 -07:00
xen xen/xenbus: Add quirk to deal with misconfigured backends. 2012-04-27 09:51:05 -07:00
zorro zorro: Defer device_register() until all devices have been identified 2011-10-03 11:40:57 -07:00
Kconfig
Makefile