OpenCloudOS-Kernel/drivers/staging/greybus
Rui Miguel Silva b17c1bba9c staging: greybus: timesync: validate platform state callback
When tearingdown timesync, and not in arche platform, the state platform
callback is not initialized. That will trigger the following NULL
dereferencing.
CallTrace:

 ? gb_timesync_platform_unlock_bus+0x11/0x20 [greybus]
 gb_timesync_teardown+0x85/0xc0 [greybus]
 gb_timesync_svc_remove+0xab/0x190 [greybus]
 gb_svc_del+0x29/0x110 [greybus]
 gb_hd_del+0x14/0x20 [greybus]
 ap_disconnect+0x24/0x60 [gb_es2]
 usb_unbind_interface+0x7a/0x2c0
 __device_release_driver+0x96/0x150
 device_release_driver+0x1e/0x30
 bus_remove_device+0xe7/0x130
 device_del+0x116/0x230
 usb_disable_device+0x97/0x1f0
 usb_disconnect+0x80/0x260
 hub_event+0x5ca/0x10e0
 process_one_work+0x126/0x3b0
 worker_thread+0x55/0x4c0
 ? process_one_work+0x3b0/0x3b0
 kthread+0xc4/0xe0
 ? kthread_park+0xb0/0xb0
 ret_from_fork+0x22/0x30

So, fix that by adding checks before use the callback.

Fixes: 970dc85bd9 ("greybus: timesync: Add timesync core driver")
Cc: <stable@vger.kernel.org> # 4.9.x
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25 11:36:59 +01:00
..
Documentation staging: greybus: remove old es1 endpoint description 2016-09-19 12:40:33 +02:00
tools staging: greybus: remove .gitignore file 2016-09-19 12:37:09 +02:00
Kconfig staging: greybus: fix up camera Kconfig dependancies 2016-09-21 12:35:13 +02:00
Makefile staging: greybus: makefile: fix dependency of spi to spilib 2016-09-19 16:49:53 +02:00
arche-apb-ctrl.c staging: greybus: fix block comment 2016-10-16 10:24:20 +02:00
arche-platform.c Merge 4.9-rc5 into staging-next 2016-11-14 08:53:56 +01:00
arche_platform.h greybus: timesync: Add timesync core driver 2016-06-06 20:37:47 -07:00
arpc.h greybus: es2: remove obsolete cport-reset ARPC 2016-08-26 13:21:13 +02:00
audio_apbridgea.c greybus: audio: apbridgea: Remove GET_TX/RX_DELAY message types 2016-08-03 10:59:13 +02:00
audio_apbridgea.h greybus: audio: apbridgea: Remove GET_TX/RX_DELAY message types 2016-08-03 10:59:13 +02:00
audio_codec.c staging: greybus: audio_codec: Remove useless return statement. 2016-10-16 10:27:35 +02:00
audio_codec.h staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_gb.c staging: greybus: use preferred kernel type u16 2016-09-20 13:24:46 +02:00
audio_manager.c greybus: audio: gb_manager: Use valid argument while removing ida allocated id. 2016-05-18 16:33:31 -07:00
audio_manager.h staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_manager_module.c staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_manager_private.h greybus: audio: Add Audio Manager 2016-01-13 16:12:56 -08:00
audio_manager_sysfs.c staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_module.c staging: greybus: audio_module: remove redundant OOM message 2016-12-07 11:41:17 +01:00
audio_topology.c drivers: staging: greybus: Fixed CHECKS for brace issues 2016-10-16 10:24:21 +02:00
authentication.c greybus: firmware: Add runtime PM support 2016-07-26 15:29:00 -07:00
bootrom.c greybus: replace Ara references 2016-07-28 07:30:13 -07:00
bundle.c staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
bundle.h staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
camera.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-12-16 10:24:44 -08:00
connection.c greybus: connection: implement new connection handling 2016-08-26 13:21:13 +02:00
connection.h greybus: connection: add support for high-priority connections 2016-06-24 16:22:30 -07:00
control.c greybus: control: make disconnecting a core operation 2016-08-11 14:13:07 +02:00
control.h greybus: control: suppress bundle_activate() for bootrom 2016-07-21 16:36:48 -07:00
core.c greybus: pm: add error handling to bundle activation 2016-07-21 18:54:11 -07:00
debugfs.c greybus: core: add device prefix to error messages 2016-02-11 21:44:17 -08:00
es2.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-12-16 10:24:44 -08:00
firmware.h greybus: firmware: add comment to show size calculations 2016-08-12 17:38:19 +02:00
fw-core.c staging: greybus: spi: remove KERNEL_VERSION checks 2016-09-19 16:43:27 +02:00
fw-download.c greybus: firmware: s/should/must 2016-08-12 17:38:19 +02:00
fw-management.c greybus: firmware: s/_LEN/_SIZE 2016-08-12 17:38:19 +02:00
gb-camera.h greybus: camera: Update CSI config parameters 2016-07-17 10:31:21 +09:00
gbphy.c staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
gbphy.h staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
gpio.c Staging: greybus: gpio: Use gbphy_dev->dev instead of bundle->dev 2016-10-17 09:14:55 +02:00
greybus.h staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
greybus_authentication.h greybus: Add Component Authentication Protocol support 2016-07-06 17:51:32 -05:00
greybus_firmware.h greybus: firmware: s/_LEN/_SIZE 2016-08-12 17:38:19 +02:00
greybus_id.h greybus: Use BIT(2) for GREYBUS_ID_MATCH_CLASS 2016-06-09 17:28:02 -07:00
greybus_manifest.h greybus: Add Component Authentication Protocol support 2016-07-06 17:51:32 -05:00
greybus_protocols.h greybus: greybus_protocols: remove svc key-event type 2016-09-02 14:13:39 +02:00
greybus_trace.h greybus: tracing: drop "greybus" prefix 2016-06-09 12:12:43 -07:00
hd.c greybus: hd: arche-platform: implement greybus shutdown 2016-07-16 07:58:52 +09:00
hd.h greybus: hd/es2: remove obsolete callbacks 2016-08-26 13:21:13 +02:00
hid.c staging: greybus: hid: remove KERNEL_VERSION checks 2016-09-19 16:30:41 +02:00
i2c.c greybus: i2c: add runtime pm support 2016-07-14 16:53:55 -05:00
interface.c staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
interface.h greybus: replace Ara references 2016-07-28 07:30:13 -07:00
light.c staging: greybus: light: check the correct value of delay_on 2016-10-02 15:49:26 +02:00
log.c Staging: Greybus: Fix trailing */ in block comments 2016-10-24 15:48:02 +02:00
loopback.c staging: greybus: Use setup_timer function 2016-09-23 19:00:43 +02:00
manifest.c greybus: manifest: style fix missing space before '(' 2016-09-27 12:59:51 +02:00
manifest.h greybus: manifest: Use interface descriptor instead of module descriptor to get information 2015-04-06 12:05:58 +02:00
module.c greybus: fix a leak on error in gb_module_create() 2016-10-24 15:51:00 +02:00
module.h greybus: core: add module abstraction 2016-04-25 11:08:30 -07:00
operation.c greybus: operation: clean up request handler 2016-07-26 14:53:19 -07:00
operation.h greybus: operation: add helper for creating core operations 2016-05-27 12:21:16 -07:00
power_supply.c staging: greybus: power_supply: remove KERNEL_VERSION checks 2016-09-19 16:48:44 +02:00
pwm.c greybus: pwm: Add runtime_pm support 2016-07-14 16:53:55 -05:00
raw.c greybus: raw: use hexadecimal notation for request types 2016-03-03 10:02:48 -08:00
sdio.c staging: Greybus: Remove unnecessary braces for single statement block 2016-11-19 14:23:09 +01:00
spi.c staging: greybus: spi: remove KERNEL_VERSION checks 2016-09-19 16:43:27 +02:00
spilib.c staging: greybus: spi: remove KERNEL_VERSION checks 2016-09-19 16:43:27 +02:00
spilib.h greybus: spilib: make spilib independent of gbphy 2016-07-21 19:03:05 -07:00
svc.c don't open-code file_inode() 2016-12-04 18:29:28 -05:00
svc.h greybus: svc_watchdog: Add sysfs file to change the behavior of bite 2016-07-26 20:58:37 -07:00
svc_watchdog.c greybus: svc_watchdog: use schedule_delayed_work helper 2016-08-03 10:59:13 +02:00
timesync.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-12-16 10:24:44 -08:00
timesync.h greybus: timesync: Add gb_timesync_frame_time_to_timespec() 2016-06-06 20:50:08 -07:00
timesync_platform.c staging: greybus: timesync: validate platform state callback 2017-01-25 11:36:59 +01:00
uart.c staging: greybus: use get_icount tty operation 2016-11-10 14:06:23 +01:00
usb.c greybus: gbphy: Remove protocol specific version handling 2016-05-31 22:02:58 -07:00
vibrator.c staging: greybus: vibrator: remove KERNEL_VERSION checks 2016-09-19 16:30:41 +02:00