[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1370338722-3646-1-git-send-email-holler@ahsoftware.de>
Date: Tue, 4 Jun 2013 11:38:42 +0200
From: Alexander Holler <holler@...oftware.de>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, rtc-linux@...glegroups.com,
Alessandro Zummo <a.zummo@...ertech.it>,
John Stultz <john.stultz@...aro.org>,
Alexander Holler <holler@...oftware.de>
Subject: [PATCH] rtc: rtc-hid-sensor-time: fix possible bug on driver_remove
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@...oftware.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists