+ input-reduce-raciness-when-input-handlers-disconnect.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Input: reduce raciness when input handlers disconnect
has been added to the -mm tree.  Its filename is
     input-reduce-raciness-when-input-handlers-disconnect.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Input: reduce raciness when input handlers disconnect
From: Dmitry Torokhov <dtor@xxxxxxxxxxxxx>

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 substitute 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 <dtor@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/input/evdev.c    |    2 +-
 drivers/input/joydev.c   |    2 +-
 drivers/input/mousedev.c |    2 +-
 drivers/input/tsdev.c    |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff -puN drivers/input/evdev.c~input-reduce-raciness-when-input-handlers-disconnect drivers/input/evdev.c
--- a/drivers/input/evdev.c~input-reduce-raciness-when-input-handlers-disconnect
+++ a/drivers/input/evdev.c
@@ -699,9 +699,9 @@ static void evdev_disconnect(struct inpu
 	if (evdev->open) {
 		input_flush_device(handle, NULL);
 		input_close_device(handle);
-		wake_up_interruptible(&evdev->wait);
 		list_for_each_entry(client, &evdev->client_list, node)
 			kill_fasync(&client->fasync, SIGIO, POLL_HUP);
+		wake_up_interruptible(&evdev->wait);
 	} else
 		evdev_free(evdev);
 }
diff -puN drivers/input/joydev.c~input-reduce-raciness-when-input-handlers-disconnect drivers/input/joydev.c
--- a/drivers/input/joydev.c~input-reduce-raciness-when-input-handlers-disconnect
+++ a/drivers/input/joydev.c
@@ -619,9 +619,9 @@ static void joydev_disconnect(struct inp
 
 	if (joydev->open) {
 		input_close_device(handle);
-		wake_up_interruptible(&joydev->wait);
 		list_for_each_entry(client, &joydev->client_list, node)
 			kill_fasync(&client->fasync, SIGIO, POLL_HUP);
+		wake_up_interruptible(&joydev->wait);
 	} else
 		joydev_free(joydev);
 }
diff -puN drivers/input/mousedev.c~input-reduce-raciness-when-input-handlers-disconnect drivers/input/mousedev.c
--- a/drivers/input/mousedev.c~input-reduce-raciness-when-input-handlers-disconnect
+++ a/drivers/input/mousedev.c
@@ -766,9 +766,9 @@ static void mousedev_disconnect(struct i
 
 	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);
 }
diff -puN drivers/input/tsdev.c~input-reduce-raciness-when-input-handlers-disconnect drivers/input/tsdev.c
--- a/drivers/input/tsdev.c~input-reduce-raciness-when-input-handlers-disconnect
+++ a/drivers/input/tsdev.c
@@ -476,9 +476,9 @@ static void tsdev_disconnect(struct inpu
 
 	if (tsdev->open) {
 		input_close_device(handle);
-		wake_up_interruptible(&tsdev->wait);
 		list_for_each_entry(client, &tsdev->client_list, node)
 			kill_fasync(&client->fasync, SIGIO, POLL_HUP);
+		wake_up_interruptible(&tsdev->wait);
 	} else
 		tsdev_free(tsdev);
 }
_

Patches currently in -mm which might be from dtor@xxxxxxxxxxxxx are

origin.patch
git-dvb.patch
git-input.patch
input-reduce-raciness-when-input-handlers-disconnect.patch
input-convert-from-class-devices-to-standard-devices.patch
ibmasm-whitespace-cleanup.patch
ibmasm-dont-use-extern-in-function-declarations.patch
ibmasm-miscellaneous-fixes.patch
ibmasm-must-depend-on-config_input.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux