mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + fseventpoll-dont-test-for-bitfield-with-stack-value.patch added to -mm tree
@ 2017-02-15  0:03 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-02-15  0:03 UTC (permalink / raw)
  To: gorcunov, avagin, viro, mm-commits


The patch titled
     Subject: fs,eventpoll: Don't test for bitfield with stack value
has been added to the -mm tree.  Its filename is
     fseventpoll-dont-test-for-bitfield-with-stack-value.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/fseventpoll-dont-test-for-bitfield-with-stack-value.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/fseventpoll-dont-test-for-bitfield-with-stack-value.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Cyrill Gorcunov <gorcunov@gmail.com>
Subject: fs,eventpoll: Don't test for bitfield with stack value

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.

Link: http://lkml.kernel.org/r/20170214154935.GG1850@uranus.lan
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/eventpoll.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/eventpoll.c~fseventpoll-dont-test-for-bitfield-with-stack-value fs/eventpoll.c
--- a/fs/eventpoll.c~fseventpoll-dont-test-for-bitfield-with-stack-value
+++ a/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) ||
_

Patches currently in -mm which might be from gorcunov@gmail.com are

fseventpoll-dont-test-for-bitfield-with-stack-value.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-15  0:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  0:03 + fseventpoll-dont-test-for-bitfield-with-stack-value.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).