alistair23-linux/drivers/char
Takao Indoh 567eded965 ipmi: Clear drvdata when interface is removed
This patch fixes a bug on hotmod removing.

After ipmi interface is removed using hotmod, kernel panic occurs when
rmmod impi_si.  For example, try this:

 # echo "remove,"`cat /proc/ipmi/0/params` > \
 /sys/module/ipmi_si/parameters/hotmod
 # rmmod ipmi_si

Then, rmmod fails with the following messages.

  ------------[ cut here ]------------
  WARNING: CPU: 12 PID: 10819 at /mnt/repos/linux/lib/list_debug.c:53 __list_del_entry+0x63/0xd0()
  CPU: 12 PID: 10819 Comm: rmmod Not tainted 3.17.0-rc1 #19
  Hardware name: FUJITSU-SV PRIMERGY BX920 S2/D3030, BIOS 080015 Rev.3D81.3030 02/10/2012
  Call Trace:
    dump_stack+0x45/0x56
    warn_slowpath_common+0x7d/0xa0
    warn_slowpath_fmt+0x4c/0x50
    __list_del_entry+0x63/0xd0
    list_del+0xd/0x30
    cleanup_one_si+0x2a/0x230 [ipmi_si]
    ipmi_pnp_remove+0x15/0x20 [ipmi_si]
    pnp_device_remove+0x24/0x40
    __device_release_driver+0x7f/0xf0
    driver_detach+0xb0/0xc0
    bus_remove_driver+0x55/0xd0
    driver_unregister+0x2c/0x50
    pnp_unregister_driver+0x12/0x20
    cleanup_ipmi_si+0xbc/0xf0 [ipmi_si]
    SyS_delete_module+0x132/0x1c0
    system_call_fastpath+0x16/0x1b
  ---[ end trace 70b4377268f85c23 ]---

list_del in cleanup_one_si() fails because the smi_info is already
removed when hotmod removing.

When ipmi interface is removed by hotmod, smi_info is removed by
cleanup_one_si(), but is is still set in drvdata.  Therefore when rmmod
ipmi_si, ipmi_pnp_remove tries to remove it again and fails.

By this patch, a pointer to smi_info in drvdata is cleared when hotmod
removing so that it will be not accessed when rmmod.

changelog:
v2:
- Clear drvdata in cleanup_one_si
- Change subject

v1:
https://lkml.org/lkml/2014/9/8/741

Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-07 13:22:32 -04:00
..
agp agp: remove read/write stubs 2014-08-02 06:43:51 +10:00
hw_random virtio-rng: skip reading when we start to remove the device 2014-09-11 22:28:38 +09:30
ipmi ipmi: Clear drvdata when interface is removed 2014-10-07 13:22:32 -04:00
mwave drivers/char: delete non-required instances of include <linux/init.h> 2014-02-07 15:10:19 -08:00
pcmcia char: synclink: Remove WARN_ON for bad port count 2014-07-10 16:07:46 -07:00
tpm tpm: simplify code by using %*phN specifier 2014-07-29 23:10:56 +02:00
xilinx_hwicap char: xilinx_hwicap: missing error code if ioremap() fails 2014-07-09 16:59:58 -07:00
apm-emulation.c apm-emulation: add hibernation APM events to support suspend2disk 2014-01-07 13:50:28 +01:00
applicom.c applicom: dereferencing NULL on error path 2014-05-27 17:43:12 -07:00
applicom.h
bfin-otp.c
bsr.c bsr: avoid format string leaking into device name 2014-07-09 16:59:15 -07:00
ds1302.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
ds1620.c ds1620: single_open() leak 2013-05-05 00:11:29 -04:00
dsp56k.c drivers/char/dsp56k.c: drop check for negativity of unsigned parameter 2014-07-17 18:38:37 -07:00
dtlk.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
efirtc.c rtc: single_open() leaks 2013-05-05 00:12:29 -04:00
generic_nvram.c drivers: fix up various ->llseek() implementations 2011-07-20 20:47:58 -04:00
genrtc.c rtc: single_open() leaks 2013-05-05 00:12:29 -04:00
hangcheck-timer.c hangcheck-timer: Use ktime_get_ns() 2014-07-23 15:01:49 -07:00
hpet.c ACPI: Clean up inclusions of ACPI header files 2013-12-07 01:03:14 +01:00
i8k.c Merge 3.16-rc5 into char-misc-next 2014-07-13 15:26:47 -07:00
Kconfig ttyprintk: Allow built as a module 2014-04-16 14:21:06 -07:00
lp.c char: Int overflow in lp_do_ioctl(). 2013-12-18 16:39:54 -08:00
Makefile Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-01-29 20:49:12 -08:00
mbcs.c char: remove use of __devinitconst 2012-11-21 12:55:19 -08:00
mbcs.h Fix common misspellings 2011-03-31 11:26:23 -03:00
mem.c /dev/mem: handle out-of-bounds read/write 2014-02-15 11:51:02 -08:00
misc.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
mmtimer.c drivers/char/mmtimer.c: Remove useless kfree 2012-09-26 13:20:40 -07:00
msm_smd_pkt.c treewide: Fix typos in printk 2013-12-19 15:10:49 +01:00
mspec.c char: Use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT 2013-05-21 10:07:54 -07:00
nsc_gpio.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
nvram.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
nwbutton.c char: nwbutton: open-code interruptible_sleep_on 2014-01-08 15:29:52 -08:00
nwbutton.h
nwflash.c Merge branch 'late/fixes' into fixes 2012-10-07 07:22:32 -07:00
pc8736x_gpio.c pc8736x_gpio: use platform_device_unregister in pc8736x_gpio_cleanup() 2012-10-24 15:52:29 -07:00
ppdev.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
ps3flash.c ps3flash: switch to generic_file_llseek_size() 2013-06-29 12:57:33 +04:00
random.c Cleanups and bug fixes to /dev/random, add a new getrandom(2) system 2014-08-06 08:16:24 -07:00
raw.c blkdev_aio_write() - turn into blkdev_write_iter() 2014-05-06 17:38:01 -04:00
rtc.c various char drivers: remove deprecated IRQF_DISABLED 2013-10-16 12:36:10 -07:00
scx200_gpio.c
snsc.c various char drivers: remove deprecated IRQF_DISABLED 2013-10-16 12:36:10 -07:00
snsc.h
snsc_event.c various char drivers: remove deprecated IRQF_DISABLED 2013-10-16 12:36:10 -07:00
sonypi.c ACPI: Remove the old /proc/acpi/event interface 2013-07-15 13:56:36 +02:00
tb0219.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
tile-srom.c drivers/char: delete non-required instances of include <linux/init.h> 2014-02-07 15:10:19 -08:00
tlclk.c tlclk: remove deprecated IRQF_DISABLED 2013-10-16 12:36:10 -07:00
toshiba.c
ttyprintk.c ttyprintk: Allow built as a module 2014-04-16 14:21:06 -07:00
uv_mmtimer.c
virtio_console.c virtio: console: remove unnecessary null test before debugfs_remove_recursive 2014-07-27 21:07:14 +09:30