From: Rafael J. Wysocki Date: Mon, 21 May 2012 19:20:48 +0000 (+0200) Subject: epoll: Fix user space breakage related to EPOLLWAKEUP X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a8159414d7e3af7233e7a5a82d1c5d85379bd75c;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git epoll: Fix user space breakage related to EPOLLWAKEUP Commit 4d7e30d (epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready) caused some applications to malfunction, because they set the bit corresponding to the new EPOLLWAKEUP flag in their eventpoll flags and they don't have the new CAP_EPOLLWAKEUP capability. To prevent that from happening, change epoll_ctl() to clear EPOLLWAKEUP in epds.events if the caller doesn't have the CAP_EPOLLWAKEUP capability instead of failing and returning an error code, which allows the affected applications to function normally. Reported-and-tested-by: Jiri Slaby Signed-off-by: Rafael J. Wysocki --- diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 2cf0f2153be5..079d1be65ba9 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1711,7 +1711,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, /* Check if EPOLLWAKEUP is allowed */ if ((epds.events & EPOLLWAKEUP) && !capable(CAP_EPOLLWAKEUP)) - goto error_tgt_fput; + epds.events &= ~EPOLLWAKEUP; /* * We have to check that the file structure underneath the file descriptor