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
This commit is contained in:
Vladimir Kondratyev 2020-03-29 23:01:36 +00:00
parent 80ddbddfd7
commit 006eb44926
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359429

View File

@ -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;
}
}
}