drivers/poke: Only allow root() to open.

This allows applications to theoretically open() the poke device but
then change their uid/euid to something more restrictive. The mem
device is not even this permissive; but I can think of some scenarios
in which this might be useful.
This commit is contained in:
Augustin Cavalier
2018-09-01 15:43:57 -04:00
parent 8d13e72523
commit 1e3f0626ab
+3
View File
@@ -98,6 +98,9 @@ poke_open(const char* name, uint32 flags, void** cookie)
{
*cookie = NULL;
if (getuid() != 0 && geteuid() != 0)
return EPERM;
if (atomic_add(&open_count, 1) != 0) {
atomic_add(&open_count, -1);
return B_BUSY;