Messages in this thread Patch in this message | | | From | Alexander Holler <> | Subject | [PATCH] rtc: rtc-hid-sensor-time: fix possible bug on driver_remove | Date | Tue, 4 Jun 2013 11:38:42 +0200 |
| |
The work we schedule on register deletes himself. Therefor we cannot use cancel_work_sync() because that calls flush_work() but still uses the pointer to the (now deleted) work afterwards (for clear_work_data) which ends up in a bug. Replacing cancel_work_sync() with flush_work() fixes that.
Signed-off-by: Alexander Holler <holler@ahsoftware.de> ---
This patch applies on top of PATCH 3/4 or 4/4 of the small series of 4 patches for rtc-hid-sensor-time, which was already merged into the -mm tree.
drivers/rtc/rtc-hid-sensor-time.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c index 4aca12d..acb2bc2 100644 --- a/drivers/rtc/rtc-hid-sensor-time.c +++ b/drivers/rtc/rtc-hid-sensor-time.c @@ -414,9 +414,8 @@ static int hid_time_remove(struct platform_device *pdev) struct hid_time_state *time_state = platform_get_drvdata(pdev); if (time_state->workts) { - cancel_work_sync(&time_state->workts->work); - kfree(time_state->workts); - time_state->workts = NULL; + flush_work(&time_state->workts->work); + BUG_ON(time_state->workts != NULL); } sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); -- 1.8.1.5
| |