Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1580618 > unrolled thread
| Started by | Cyrill Gorcunov <gorcunov@gmail.com> |
|---|---|
| First post | 2017-02-14 16:50 +0100 |
| Last post | 2017-02-14 16:50 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH] fs,eventpoll: Don't test for bitfield with stack value Cyrill Gorcunov <gorcunov@gmail.com> - 2017-02-14 16:50 +0100
| From | Cyrill Gorcunov <gorcunov@gmail.com> |
|---|---|
| Date | 2017-02-14 16:50 +0100 |
| Subject | [PATCH] fs,eventpoll: Don't test for bitfield with stack value |
| Message-ID | <taNwB-3Fj-9@gated-at.bofh.it> |
In case if epoll_ctl is called with operation EPOLL_CTL_DEL then
@epds.events variable allocated on stack may contain random bits which
we test then for EPOLLEXCLUSIVE. Since currently the test look
like
if (epds.events & EPOLLEXCLUSIVE) {
if (op == EPOLL_CTL_MOD)
goto error_tgt_fput;
if (op == EPOLL_CTL_ADD && (is_file_epoll(tf.file) ||
(epds.events & ~EPOLLEXCLUSIVE_OK_BITS)))
goto error_tgt_fput;
}
Nothing serious will happen even if epds.events has this bit set,
still better to be on safe side and make sure that we're to test
this bit at all.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
fs/eventpoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-ml.git/fs/eventpoll.c
===================================================================
--- linux-ml.git.orig/fs/eventpoll.c
+++ linux-ml.git/fs/eventpoll.c
@@ -1895,7 +1895,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, in
* so EPOLLEXCLUSIVE is not allowed for a EPOLL_CTL_MOD operation.
* Also, we do not currently supported nested exclusive wakeups.
*/
- if (epds.events & EPOLLEXCLUSIVE) {
+ if (ep_op_has_event(op) && (epds.events & EPOLLEXCLUSIVE)) {
if (op == EPOLL_CTL_MOD)
goto error_tgt_fput;
if (op == EPOLL_CTL_ADD && (is_file_epoll(tf.file) ||
Back to top | Article view | linux.kernel
csiph-web