Skip to content

Commit

Permalink
epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled
Browse files Browse the repository at this point in the history
Drop EPOLLWAKEUP from epoll events mask if CONFIG_PM_SLEEP is disabled.

Signed-off-by: Amit Pundir <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
pundiramit authored and rafaeljw committed Dec 3, 2013
1 parent dc1ccc4 commit 95f19f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
goto error_tgt_fput;

/* Check if EPOLLWAKEUP is allowed */
if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
epds.events &= ~EPOLLWAKEUP;
ep_take_care_of_epollwakeup(&epds);

/*
* We have to check that the file structure underneath the file descriptor
Expand Down
13 changes: 12 additions & 1 deletion include/uapi/linux/eventpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,16 @@ struct epoll_event {
__u64 data;
} EPOLL_PACKED;


#ifdef CONFIG_PM_SLEEP
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
{
if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
epev->events &= ~EPOLLWAKEUP;
}
#else
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
{
epev->events &= ~EPOLLWAKEUP;
}
#endif
#endif /* _UAPI_LINUX_EVENTPOLL_H */

0 comments on commit 95f19f6

Please sign in to comment.