Skip to content

Commit

Permalink
Fix uninitialized lock in hostepoll.c
Browse files Browse the repository at this point in the history
Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
  • Loading branch information
mingweishih committed Jul 6, 2022
1 parent 979d0ab commit 033a319
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions syscall/devices/hostepoll/hostepoll.c
Expand Up @@ -147,6 +147,7 @@ static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags)
epoll_t* epoll = NULL;
device_t* device = _cast_device(device_);
oe_host_fd_t retval;
oe_mutexattr_t attr;

oe_errno = 0;

Expand All @@ -167,6 +168,15 @@ static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags)
epoll->magic = EPOLL_MAGIC;
epoll->host_fd = retval;

if (oe_mutexattr_init(&attr) != OE_OK)
OE_RAISE_ERRNO(OE_EFAULT);

if (oe_mutexattr_settype(&attr, OE_MUTEX_RECURSIVE) != OE_OK)
OE_RAISE_ERRNO(OE_EFAULT);

if (oe_mutex_init(&epoll->lock, &attr) != OE_OK)
OE_RAISE_ERRNO(OE_EFAULT);

ret = &epoll->base;
epoll = NULL;

Expand Down

0 comments on commit 033a319

Please sign in to comment.