diff mbox

Input: Add check for grabbed device before flushing the device

Message ID 1419918470-14940-1-git-send-email-anshul.g@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

anshul.g@samsung.com Dec. 30, 2014, 5:47 a.m. UTC
From: Anshul Garg <anshul.g@samsung.com>

If input device is grabbed then client which grabbed the device should only
flush the device and for other clients error should be returned.

Signed-off-by: Anshul Garg <anshul.g@samsung.com>
 drivers/input/evdev.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox


diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index fd325ec..70df398 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -248,6 +248,8 @@  static int evdev_flush(struct file *file, fl_owner_t id)
 	if (!evdev->exist || client->revoked)
 		retval = -ENODEV;
+	else if (evdev->grab != client)
+		retval = -EINVAL;
 		retval = input_flush_device(&evdev->handle, file);