mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Avoid unnecessary copy for EPOLL_CTL_DEL
Date: Sun, 03 Oct 2004 00:08:17 -0700	[thread overview]
Message-ID: <415FA561.2010804@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When epoll_ctl() is used with the EPOLL_CTL_DEL operation the event
structure pointed to by the fourth parameter is unnecessarily copied.
It is not used and userlevel would have to initialize some memory to
avoid passing down a pointer to some uninitialized memory.  The attached
patch should work just fine.

Signed-off-by: Ulrich Drepper <drepper@redhat.com>

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBX6Vh2ijCOnn/RHQRAo0HAJ0UyKipkrlhK6xiNgeoOBsoK7bxEgCgqCMK
xI430mMmGxi9Ce1jBTZFYK4=
=Gq3D
-----END PGP SIGNATURE-----

[-- Attachment #2: d-epoll-del --]
[-- Type: text/plain, Size: 467 bytes --]

--- fs/eventpoll.c	2004-08-26 19:14:51.000000000 -0700
+++ fs/eventpoll.c.new	2004-10-03 00:04:33.000000000 -0700
@@ -531,7 +531,8 @@ sys_epoll_ctl(int epfd, int op, int fd, 
 		     current, epfd, op, fd, event));
 
 	error = -EFAULT;
-	if (copy_from_user(&epds, event, sizeof(struct epoll_event)))
+	if (op != EPOLL_CTL_DEL &&
+	    copy_from_user(&epds, event, sizeof(struct epoll_event)))
 		goto eexit_1;
 
 	/* Get the "struct file *" for the eventpoll file */

                 reply	other threads:[~2004-10-03  7:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=415FA561.2010804@redhat.com \
    --to=drepper@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome