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:
@@ -98,6 +98,9 @@ poke_open(const char* name, uint32 flags, void** cookie)
|
|||||||
{
|
{
|
||||||
*cookie = NULL;
|
*cookie = NULL;
|
||||||
|
|
||||||
|
if (getuid() != 0 && geteuid() != 0)
|
||||||
|
return EPERM;
|
||||||
|
|
||||||
if (atomic_add(&open_count, 1) != 0) {
|
if (atomic_add(&open_count, 1) != 0) {
|
||||||
atomic_add(&open_count, -1);
|
atomic_add(&open_count, -1);
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
|
|||||||
Reference in New Issue
Block a user