From 1dfa2812404c37d7571622195f907cea3331616c Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 3 Jun 2007 23:29:36 -0400 Subject: Input: reduce raciness when input handlers disconnect There is a race between input handler's release() and disconnect() methods: when input handler disconnects it wakes up all regular users and then process to walk user list to wake up async. users. While disconnect() walks the list release() removes elements of the same list causing oopses. While this is not a substibute for proper locking we can reduce odds of getting an oops if we wake up normal readers after walking the list. Signed-off-by: Dmitry Torokhov --- drivers/input/mousedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mousedev.c') diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 7678e9876550..dc78f62cbee1 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -767,9 +767,9 @@ static void mousedev_disconnect(struct input_handle *handle) if (mousedev->open) { input_close_device(handle); - wake_up_interruptible(&mousedev->wait); list_for_each_entry(client, &mousedev->client_list, node) kill_fasync(&client->fasync, SIGIO, POLL_HUP); + wake_up_interruptible(&mousedev->wait); } else mousedev_free(mousedev); } -- cgit v1.2.3-59-g8ed1b