Skip to content

Commit 95f19f6

Browse files
pundiramitrafaeljw
authored andcommitted
epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled
Drop EPOLLWAKEUP from epoll events mask if CONFIG_PM_SLEEP is disabled. Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Cc: John Stultz <john.stultz@linaro.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent dc1ccc4 commit 95f19f6

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎fs/eventpoll.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
18521852
goto error_tgt_fput;
18531853

18541854
/* Check if EPOLLWAKEUP is allowed */
1855-
if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
1856-
epds.events &= ~EPOLLWAKEUP;
1855+
ep_take_care_of_epollwakeup(&epds);
18571856

18581857
/*
18591858
* We have to check that the file structure underneath the file descriptor

‎include/uapi/linux/eventpoll.h‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,16 @@ struct epoll_event {
6161
__u64 data;
6262
} EPOLL_PACKED;
6363

64-
64+
#ifdef CONFIG_PM_SLEEP
65+
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
66+
{
67+
if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
68+
epev->events &= ~EPOLLWAKEUP;
69+
}
70+
#else
71+
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
72+
{
73+
epev->events &= ~EPOLLWAKEUP;
74+
}
75+
#endif
6576
#endif /* _UAPI_LINUX_EVENTPOLL_H */

0 commit comments

Comments
 (0)