patch-1.3.28 linux/fs/proc/link.c

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

diff -u --recursive --new-file v1.3.27/linux/fs/proc/link.c linux/fs/proc/link.c
@@ -128,13 +128,20 @@
 	new_inode = NULL;
 	switch (ino) {
 		case PROC_PID_CWD:
+			if (!p->fs)
+				break;
 			new_inode = p->fs->pwd;
 			break;
 		case PROC_PID_ROOT:
+			if (!p->fs)
+				break;
 			new_inode = p->fs->root;
 			break;
 		case PROC_PID_EXE: {
-			struct vm_area_struct * vma = p->mm->mmap;
+			struct vm_area_struct * vma;
+			if (!p->mm)
+				break;
+			vma = p->mm->mmap;
 			while (vma) {
 				if (vma->vm_flags & VM_EXECUTABLE) {
 					new_inode = vma->vm_inode;
@@ -147,6 +154,8 @@
 		default:
 			switch (ino >> 8) {
 			case PROC_PID_FD_DIR:
+				if (!p->files)
+					break;
 				ino &= 0xff;
 				if (ino < NR_OPEN && p->files->fd[ino]) {
 #ifdef PLAN9_SEMANTICS
@@ -183,7 +192,7 @@
 		return i;
 	if (!inode)
 		return -EIO;
-	dev = inode->i_dev;
+	dev = kdev_t_to_nr(inode->i_dev);
 	ino = inode->i_ino;
 	iput(inode);
 	i = sprintf(buf,"[%04x]:%u", dev, ino);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this