1
0
Fork 0
remarkable-linux/drivers/char/ipmi
Corey Minyard 888e989a75 ipmi: Fix I2C client removal in the SSIF driver
commit 0745dde628 upstream.

The SSIF driver was removing any client that came in through the
platform interface, but it should only remove clients that it
added.  On a failure in the probe function, this could result
in the following oops when the driver is removed and the
client gets unregistered twice:

 CPU: 107 PID: 30266 Comm: rmmod Not tainted 4.18.0+ #80
 Hardware name: Cavium Inc. Saber/Saber, BIOS Cavium reference firmware version 7.0 08/04/2018
 pstate: 60400009 (nZCv daif +PAN -UAO)
 pc : kernfs_find_ns+0x28/0x120
 lr : kernfs_find_and_get_ns+0x40/0x60
 sp : ffff00002310fb50
 x29: ffff00002310fb50 x28: ffff800a8240f800
 x27: 0000000000000000 x26: 0000000000000000
 x25: 0000000056000000 x24: ffff000009073000
 x23: ffff000008998b38 x22: 0000000000000000
 x21: ffff800ed86de820 x20: 0000000000000000
 x19: ffff00000913a1d8 x18: 0000000000000000
 x17: 0000000000000000 x16: 0000000000000000
 x15: 0000000000000000 x14: 5300737265766972
 x13: 643d4d4554535953 x12: 0000000000000030
 x11: 0000000000000030 x10: 0101010101010101
 x9 : ffff800ea06cc3f9 x8 : 0000000000000000
 x7 : 0000000000000141 x6 : ffff000009073000
 x5 : ffff800adb706b00 x4 : 0000000000000000
 x3 : 00000000ffffffff x2 : 0000000000000000
 x1 : ffff000008998b38 x0 : ffff000008356760
 Process rmmod (pid: 30266, stack limit = 0x00000000e218418d)
 Call trace:
  kernfs_find_ns+0x28/0x120
  kernfs_find_and_get_ns+0x40/0x60
  sysfs_unmerge_group+0x2c/0x6c
  dpm_sysfs_remove+0x34/0x70
  device_del+0x58/0x30c
  device_unregister+0x30/0x7c
  i2c_unregister_device+0x84/0x90 [i2c_core]
  ssif_platform_remove+0x38/0x98 [ipmi_ssif]
  platform_drv_remove+0x2c/0x6c
  device_release_driver_internal+0x168/0x1f8
  driver_detach+0x50/0xbc
  bus_remove_driver+0x74/0xe8
  driver_unregister+0x34/0x5c
  platform_driver_unregister+0x20/0x2c
  cleanup_ipmi_ssif+0x50/0xd82c [ipmi_ssif]
  __arm64_sys_delete_module+0x1b4/0x220
  el0_svc_handler+0x104/0x160
  el0_svc+0x8/0xc
 Code: aa1e03e0 aa0203f6 aa0103f7 d503201f (7940e280)
 ---[ end trace 09f0e34cce8e2d8c ]---
 Kernel panic - not syncing: Fatal exception
 SMP: stopping secondary CPUs
 Kernel Offset: disabled
 CPU features: 0x23800c38

So track the clients that the SSIF driver adds and only remove
those.

Reported-by: George Cherian <george.cherian@cavium.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Tested-by: George Cherian <george.cherian@cavium.com>
Cc: <stable@vger.kernel.org> # 4.14.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:06 +02:00
..
Kconfig ipmi: Create a platform device for a DMI-specified IPMI interface 2017-06-19 12:49:36 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bt-bmc.c ipmi: bt-bmc: Add ast2500 compatible string 2017-04-07 12:25:38 -05:00
ipmi_bt_sm.c ipmi:bt: Set the timeout before doing a capabilities check 2018-07-03 11:24:49 +02:00
ipmi_devintf.c ipmi: get rid of field-by-field __get_user() 2017-06-26 17:02:54 -04:00
ipmi_dmi.c ipmi: use dynamic memory for DMI driver override 2018-02-16 20:23:06 +01:00
ipmi_dmi.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ipmi_kcs_sm.c ipmi: Make some data const that was only read 2015-09-03 15:02:27 -05:00
ipmi_msghandler.c ipmi: fix unsigned long underflow 2017-11-24 08:37:04 +01:00
ipmi_powernv.c ipmi/powernv: Fix error return code in ipmi_powernv_probe() 2018-04-26 11:02:08 +02:00
ipmi_poweroff.c char: Convert use of typedef ctl_table to struct ctl_table 2013-06-17 16:43:08 -07:00
ipmi_si_intf.c Revert "ipmi_si: fix memory leak on new_smi" 2017-12-29 17:53:49 +01:00
ipmi_si_sm.h ipmi: Make some data const that was only read 2015-09-03 15:02:27 -05:00
ipmi_smic_sm.c ipmi: Make some data const that was only read 2015-09-03 15:02:27 -05:00
ipmi_ssif.c ipmi: Fix I2C client removal in the SSIF driver 2018-09-26 08:38:06 +02:00
ipmi_watchdog.c Some small fixes for IPMI, and one medium sized changed. 2017-07-10 10:59:29 -07:00