Re: [PATCH] evdev: Release eventual input device grabs whengetting disconnected

From: Johannes Berg
Date: Tue Apr 01 2008 - 07:49:22 EST



> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -853,6 +853,9 @@ static void evdev_cleanup(struct evdev *evdev)
> evdev_hangup(evdev);
> evdev_remove_chrdev(evdev);
>
> + if (evdev->grab)
> + evdev_ungrab(evdev, evdev->grab);
> +

You might want to insert a comment about why this is safe and doesn't
race since it's not entirely trivial to see because everything else that
manipulates the grab needs to take the mutex. In fact, I'm not entirely
sure it's race-free but at least it can't race against the ioctl handler
because by this time ->exist will be 0.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part