changeset 3760:928a7412f6c1

6422458 /dev/poll dp_nfds checking off-by-one; application failures ensue
author sp92102
date Sun, 04 Mar 2007 19:53:36 -0800
parents f817e8463cb0
children f5abe2a41b3e
files usr/src/uts/common/io/devpoll.c usr/src/uts/common/syscall/poll.c
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/devpoll.c	Sun Mar 04 16:03:47 2007 -0800
+++ b/usr/src/uts/common/io/devpoll.c	Sun Mar 04 19:53:36 2007 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -781,7 +780,7 @@
 			 * current maximum open file count.
 			 */
 			mutex_enter(&p->p_lock);
-			if (nfds >= p->p_fno_ctl) {
+			if (nfds > p->p_fno_ctl) {
 				mutex_exit(&p->p_lock);
 				DP_REFRELE(dpep);
 				return (EINVAL);
--- a/usr/src/uts/common/syscall/poll.c	Sun Mar 04 16:03:47 2007 -0800
+++ b/usr/src/uts/common/syscall/poll.c	Sun Mar 04 19:53:36 2007 -0800
@@ -355,7 +355,7 @@
 		goto pollout;
 	}
 
-	if (nfds >= p->p_fno_ctl) {
+	if (nfds > p->p_fno_ctl) {
 		mutex_enter(&p->p_lock);
 		(void) rctl_action(rctlproc_legacy[RLIMIT_NOFILE],
 		    p->p_rctls, p, RCA_SAFE);