linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: evdev - Use EBADFD for flush() errors
@ 2015-08-19  7:38 Takashi Iwai
  2015-09-01  5:23 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2015-08-19  7:38 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Al Viro, linux-input

We've got bug reports showing the old systemd-logind (at least
system-210) aborting unexpectedly, and this turned out to be because
of an invalid error code from close() call to evdev devices.  close()
is supposed to return only either EINTR or EBADFD, while the device
returned ENODEV.  logind was overreacting to it and decided to kill
itself when an unexpected error code was received.  What a tragedy.

The bad error code comes from flush fops, and actually evdev_flush()
returns -ENODEV and else.  This patch papers over it, simply fixing
the error return code to the acceptable values above.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/input/evdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 9d35499faca4..28e9efd837e1 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -302,7 +302,7 @@ static int evdev_flush(struct file *file, fl_owner_t id)
 		retval = input_flush_device(&evdev->handle, file);
 
 	mutex_unlock(&evdev->mutex);
-	return retval;
+	return retval < 0 ? -EBADFD : 0;
 }
 
 static void evdev_free(struct device *dev)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-04  5:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19  7:38 [PATCH] Input: evdev - Use EBADFD for flush() errors Takashi Iwai
2015-09-01  5:23 ` Takashi Iwai
2015-09-04  5:37   ` Dmitry Torokhov
2015-09-04  5:42     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).