Date: Sat, 23 Jul 2016 08:23:57 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303216 - stable/11/sys/kern Message-ID: <201607230823.u6N8Nv37035911@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 23 08:23:57 2016 New Revision: 303216 URL: https://svnweb.freebsd.org/changeset/base/303216 Log: MFC r302936: Explicitely check for the valid range of file descriptor values. Approved by: re (gjb) Modified: stable/11/sys/kern/kern_event.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_event.c ============================================================================== --- stable/11/sys/kern/kern_event.c Sat Jul 23 08:06:50 2016 (r303215) +++ stable/11/sys/kern/kern_event.c Sat Jul 23 08:23:57 2016 (r303216) @@ -1183,8 +1183,11 @@ kqueue_register(struct kqueue *kq, struc findkn: if (fops->f_isfd) { KASSERT(td != NULL, ("td is NULL")); - error = fget(td, kev->ident, - cap_rights_init(&rights, CAP_EVENT), &fp); + if (kev->ident > INT_MAX) + error = EBADF; + else + error = fget(td, kev->ident, + cap_rights_init(&rights, CAP_EVENT), &fp); if (error) goto done;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607230823.u6N8Nv37035911>