From 006eb44926d6949e0b60b21920f1ea93f03efd2f Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Sun, 29 Mar 2020 23:01:36 +0000 Subject: [PATCH] evdev: return error rather than zero-length data on blocked read() if blocked process has been woken up by evdev device destruction. MFC after: 2 weeks --- sys/dev/evdev/cdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index f945101932c7..cd40d1f218a7 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -217,6 +217,8 @@ evdev_read(struct cdev *dev, struct uio *uio, int ioflag) client->ec_blocked = true; ret = mtx_sleep(client, &client->ec_buffer_mtx, PCATCH, "evread", 0); + if (ret == 0 && client->ec_revoked) + ret = ENODEV; } } }