All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "Input: evdev - do not report errors form flush()" has been added to the 4.1-stable tree
@ 2015-09-23  4:35 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-09-23  4:35 UTC (permalink / raw)
  To: tiwai, dmitry.torokhov, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    Input: evdev - do not report errors form flush()

to the 4.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     input-evdev-do-not-report-errors-form-flush.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 3 Sep 2015 22:20:00 -0700
Subject: Input: evdev - do not report errors form flush()

From: Takashi Iwai <tiwai@suse.de>

commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.

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 when device is disconnected or client's access to it is
revoked. But in these cases the fact that flush did not actually happen is
not an error, but rather normal behavior. For non-disconnected devices
result of flush is also not that interesting as there is no potential of
data loss and even if it fails application has no way of handling the
error. Because of that we are better off always returning success from
evdev_flush().

Also returning EINTR from flush()/close() is discouraged (as it is not
clear how application should handle this error), so let's stop taking
evdev->mutex interruptibly.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/input/evdev.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -290,19 +290,14 @@ static int evdev_flush(struct file *file
 {
 	struct evdev_client *client = file->private_data;
 	struct evdev *evdev = client->evdev;
-	int retval;
 
-	retval = mutex_lock_interruptible(&evdev->mutex);
-	if (retval)
-		return retval;
+	mutex_lock(&evdev->mutex);
 
-	if (!evdev->exist || client->revoked)
-		retval = -ENODEV;
-	else
-		retval = input_flush_device(&evdev->handle, file);
+	if (evdev->exist && !client->revoked)
+		input_flush_device(&evdev->handle, file);
 
 	mutex_unlock(&evdev->mutex);
-	return retval;
+	return 0;
 }
 
 static void evdev_free(struct device *dev)


Patches currently in stable-queue which might be from tiwai@suse.de are

queue-4.1/input-evdev-do-not-report-errors-form-flush.patch
queue-4.1/alsa-hda-fix-white-noise-on-dell-m3800.patch
queue-4.1/alsa-hda-add-some-fixup-quirks-for-white-noise-on-dell-laptop.patch
queue-4.1/alsa-usb-audio-correct-the-value-cache-check.patch
queue-4.1/alsa-hda-enable-headphone-jack-detect-on-old-fujitsu-laptops.patch
queue-4.1/alsa-hda-use-alc880_fixup_fujitsu-for-fsc-amilo-m1437.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-23  4:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23  4:35 Patch "Input: evdev - do not report errors form flush()" has been added to the 4.1-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.