Author: dchagin
Date: Thu Mar 30 20:04:28 2017
New Revision: 316295
URL: https://svnweb.freebsd.org/changeset/base/316295

Log:
  MFC r314309:
  
  Return EINVAL when an invalid file descriptor is specified.

Modified:
  stable/11/sys/compat/linux/linux_event.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linux/linux_event.c
==============================================================================
--- stable/11/sys/compat/linux/linux_event.c    Thu Mar 30 20:03:20 2017        
(r316294)
+++ stable/11/sys/compat/linux/linux_event.c    Thu Mar 30 20:04:28 2017        
(r316295)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to