[PATCHv2] input: polldev can cause crash in case of polling disabled
diff mbox

Message ID 1266481420-9405-1-git-send-email-samu.p.onkalo@nokia.com
State Accepted
Commit d9c4f846997c6d37e4f56907d93f1be022c17c6b
Headers show

Commit Message

samu.p.onkalo@nokia.com Feb. 18, 2010, 8:23 a.m. UTC
None

Patch
diff mbox

diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index aa6713b..291d939 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -100,6 +100,12 @@  static void input_close_polled_device(struct input_dev *input)
 	struct input_polled_dev *dev = input_get_drvdata(input);
 
 	cancel_delayed_work_sync(&dev->work);
+	/*
+	 * Clean up work struct to remove references to the workqueue.
+	 * It may be destroyed by the next call. This causes problems
+	 * at next device open-close in case of poll_interval == 0.
+	 */
+	INIT_DELAYED_WORK(&dev->work, dev->work.work.func);
 	input_polldev_stop_workqueue();
 
 	if (dev->close)