linux/drivers/platform/chrome
Pi-Hsun Shih 71cddb7097 platform/chrome: cros_ec_rpmsg: Fix race with host command when probe failed
Since the rpmsg_endpoint is created before probe is called, it's
possible that a host event is received during cros_ec_register, and
there would be some pending work in the host_event_work workqueue while
cros_ec_register is called.

If cros_ec_register fails, when the leftover work in host_event_work
run, the ec_dev from the drvdata of the rpdev could be already set to
NULL, causing kernel crash when trying to run cros_ec_get_next_event.

Fix this by creating the rpmsg_endpoint by ourself, and when
cros_ec_register fails (or on remove), destroy the endpoint first (to
make sure there's no more new calls to cros_ec_rpmsg_callback), and then
cancel all works in the host_event_work workqueue.

Cc: stable@vger.kernel.org
Fixes: 2de89fd989 ("platform/chrome: cros_ec: Add EC host command support using rpmsg")
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-09-12 16:20:50 +02:00
..
wilco_ec platform/chrome: wilco_ec: Add batt_ppid_info command to telemetry driver 2019-08-22 21:26:18 +02:00
chromeos_laptop.c platform/chrome: chromeos_laptop: drop checks of NULL-safe functions 2019-08-26 15:15:52 +02:00
chromeos_pstore.c platform/chrome: cromeos_pstore: switch to SPDX identifier 2019-02-01 10:13:05 +01:00
chromeos_tbmc.c platform/chrome: chromeos_tbmc: Report wake events 2019-09-12 16:01:35 +02:00
cros_ec_chardev.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_debugfs.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_i2c.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_ishtp.c chrome-platform fixes for v5.3-rc6 2019-09-07 08:06:24 -07:00
cros_ec_lightbar.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_lpc_mec.c platform/chrome: cros_ec_lpc_mec: Fix kernel-doc comment first line 2019-06-20 12:00:32 +02:00
cros_ec_lpc_mec.h platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec 2019-02-11 10:07:40 +01:00
cros_ec_lpc.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_proto.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_rpmsg.c platform/chrome: cros_ec_rpmsg: Fix race with host command when probe failed 2019-09-12 16:20:50 +02:00
cros_ec_spi.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_sysfs.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_trace.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_trace.h mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec_vbc.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_ec.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
cros_kbd_led_backlight.c platform/chrome: cros_kbd_led_backlight: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_usbpd_logger.c mfd / platform: cros_ec: Reorganize platform and mfd includes 2019-09-02 11:33:42 +01:00
Kconfig mfd / platform: cros_ec: Rename config to a better name 2019-09-02 11:33:35 +01:00
Makefile mfd / platform: cros_ec: Miscellaneous character device to talk with the EC 2019-09-02 11:33:21 +01:00