Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions components/libc/posix/io/timerfd/timerfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,21 @@ static int timerfd_do_settime(int fd, int flags, const struct itimerspec *new, s
}

df = fd_get(fd);
if (!df)
if (df == RT_NULL || df->vnode == RT_NULL)
{
rt_set_errno(EINVAL);
return -EINVAL;
}

#ifdef RT_USING_DFS_V2
if (df->fops != &timerfd_fops)
#else
if (df->vnode->fops != &timerfd_fops)
#endif
{
rt_set_errno(EINVAL);
return -EINVAL;
}

tfd = df->vnode->data;

Expand Down Expand Up @@ -502,7 +515,17 @@ static int timerfd_do_gettime(int fd, struct itimerspec *cur)

df = fd_get(fd);

if (df == RT_NULL)
if (df == RT_NULL || df->vnode == RT_NULL)
{
rt_set_errno(EINVAL);
return -1;
}

#ifdef RT_USING_DFS_V2
if (df->fops != &timerfd_fops)
#else
if (df->vnode->fops != &timerfd_fops)
#endif
{
rt_set_errno(EINVAL);
return -1;
Expand Down
Loading