All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Avoid unnecessary copy for EPOLL_CTL_DEL
@ 2004-10-03  7:08 Ulrich Drepper
  0 siblings, 0 replies; only message in thread
From: Ulrich Drepper @ 2004-10-03  7:08 UTC (permalink / raw)
  To: Linux Kernel, Andrew Morton; +Cc: Linus Torvalds

[-- 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 */

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

only message in thread, other threads:[~2004-10-03  7:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-03  7:08 [PATCH] Avoid unnecessary copy for EPOLL_CTL_DEL Ulrich Drepper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.