patch-2.1.122 linux/fs/devpts/root.c

Next file: linux/fs/fat/inode.c
Previous file: linux/fs/binfmt_elf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.121/linux/fs/devpts/root.c linux/fs/devpts/root.c
@@ -134,7 +134,8 @@
 static int devpts_root_lookup(struct inode * dir, struct dentry * dentry)
 {
 	struct devpts_sb_info *sbi = SBI(dir->i_sb);
-	int entry, i;
+	unsigned int entry;
+	int i;
 	const char *p;
 
 	if (!S_ISDIR(dir->i_mode))
@@ -160,11 +161,14 @@
 			entry += (*p++ - '0');
 		}
 	}
-	
+
+	if ( entry >= sbi->max_ptys )
+		return 0;
+
 	dentry->d_inode = sbi->inodes[entry];
 	if ( dentry->d_inode )
 		dentry->d_inode->i_count++;
-
+	
 	d_add(dentry, dentry->d_inode);
 
 	return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov