[PATCH] uniput - fix crash on SMP
authorDmitry Torokhov <dtor_core@ameritech.net>
Mon, 17 Oct 2005 23:43:32 +0000 (16:43 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 18 Oct 2005 00:03:57 +0000 (17:03 -0700)
Only signal completion after marking request slot as free, otherwise other
processor can free request structure before we finish using it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/input/misc/uinput.c

index d5c5b32..4015a91 100644 (file)
@@ -90,11 +90,11 @@ static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct
 
 static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request)
 {
-       complete(&request->done);
-
        /* Mark slot as available */
        udev->requests[request->id] = NULL;
        wake_up_interruptible(&udev->requests_waitq);
+
+       complete(&request->done);
 }
 
 static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)