Avoid unnecessary copy for EPOLL_CTL_DEL
PATCH 1/1 Avoid unnecessary copy for EPOLL_CTL_DEL
-----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 <[email protected]>
- --
➧ 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-----
eventpoll.c.new renamed from eventpoll.c +2 -1
@@ -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 */