linux/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
arche_platform.h
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
arpc.h greybus: es2: remove obsolete cport-reset ARPC 2016-08-26 13:21:13 +02:00
audio_apbridgea.c
audio_apbridgea.h
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_module.c staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_manager_private.h
audio_manager_sysfs.c staging: greybus: audio: remove redundant slot field 2016-10-24 15:48:02 +02:00
audio_manager.c
audio_manager.h 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
bootrom.c
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
control.c greybus: control: make disconnecting a core operation 2016-08-11 14:13:07 +02:00
control.h
core.c
debugfs.c
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
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_authentication.h
greybus_firmware.h greybus: firmware: s/_LEN/_SIZE 2016-08-12 17:38:19 +02:00
greybus_id.h
greybus_manifest.h
greybus_protocols.h greybus: greybus_protocols: remove svc key-event type 2016-09-02 14:13:39 +02:00
greybus_trace.h
greybus.h staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
hd.c
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
interface.c staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h 2016-09-19 16:52:07 +02:00
interface.h
Kconfig staging: greybus: fix up camera Kconfig dependancies 2016-09-21 12:35:13 +02: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
Makefile staging: greybus: makefile: fix dependency of spi to spilib 2016-09-19 16:49:53 +02:00
manifest.c greybus: manifest: style fix missing space before '(' 2016-09-27 12:59:51 +02:00
manifest.h
module.c greybus: fix a leak on error in gb_module_create() 2016-10-24 15:51:00 +02:00
module.h
operation.c
operation.h
power_supply.c staging: greybus: power_supply: remove KERNEL_VERSION checks 2016-09-19 16:48:44 +02:00
pwm.c
raw.c
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
svc_watchdog.c
svc.c don't open-code file_inode() 2016-12-04 18:29:28 -05:00
svc.h
timesync_platform.c staging: greybus: timesync: validate platform state callback 2017-01-25 11:36:59 +01: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
uart.c staging: greybus: use get_icount tty operation 2016-11-10 14:06:23 +01:00
usb.c
vibrator.c staging: greybus: vibrator: remove KERNEL_VERSION checks 2016-09-19 16:30:41 +02:00