svn commit: r314309 - head/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Sun Feb 26 19:51:46 UTC 2017


Author: dchagin
Date: Sun Feb 26 19:51:44 2017
New Revision: 314309
URL: https://svnweb.freebsd.org/changeset/base/314309

Log:
  Return EINVAL when an invalid file descriptor is specified.
  
  MFC after:	1 month

Modified:
  head/sys/compat/linux/linux_event.c

Modified: head/sys/compat/linux/linux_event.c
==============================================================================
--- head/sys/compat/linux/linux_event.c	Sun Feb 26 19:25:33 2017	(r314308)
+++ head/sys/compat/linux/linux_event.c	Sun Feb 26 19:51:44 2017	(r314309)
@@ -462,8 +462,10 @@ linux_epoll_ctl(struct thread *td, struc
 	    cap_rights_init(&rights, CAP_KQUEUE_CHANGE), &epfp);
 	if (error != 0)
 		return (error);
-	if (epfp->f_type != DTYPE_KQUEUE)
+	if (epfp->f_type != DTYPE_KQUEUE) {
+		error = EINVAL;
 		goto leave1;
+	}
 
 	 /* Protect user data vector from incorrectly supplied fd. */
 	error = fget(td, args->fd, cap_rights_init(&rights, CAP_POLL_EVENT), &fp);
@@ -560,6 +562,10 @@ linux_epoll_wait_common(struct thread *t
 	    cap_rights_init(&rights, CAP_KQUEUE_EVENT), &epfp);
 	if (error != 0)
 		return (error);
+	if (epfp->f_type != DTYPE_KQUEUE) {
+		error = EINVAL;
+		goto leave;
+	}
 
 	coargs.leventlist = events;
 	coargs.p = td->td_proc;


More information about the svn-src-all mailing list