patch-2.1.45 linux/fs/binfmt_aout.c

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

diff -u --recursive --new-file v2.1.44/linux/fs/binfmt_aout.c linux/fs/binfmt_aout.c
@@ -79,6 +79,7 @@
 static inline int
 do_aout_core_dump(long signr, struct pt_regs * regs)
 {
+	struct dentry * dentry = NULL;
 	struct inode * inode = NULL;
 	struct file file;
 	unsigned short fs;
@@ -114,10 +115,12 @@
 #else
 	corefile[4] = '\0';
 #endif
-	if (open_namei(corefile,O_CREAT | 2 | O_TRUNC,0600,&inode,NULL)) {
-		inode = NULL;
+	dentry = open_namei(corefile,O_CREAT | 2 | O_TRUNC, 0600);
+	if (IS_ERR(dentry)) {
+		dentry = NULL;
 		goto end_coredump;
 	}
+	inode = dentry->d_inode;
 	if (!S_ISREG(inode->i_mode))
 		goto end_coredump;
 	if (!inode->i_op || !inode->i_op->default_file_ops)
@@ -127,7 +130,7 @@
 	file.f_mode = 3;
 	file.f_flags = 0;
 	file.f_count = 1;
-	file.f_inode = inode;
+	file.f_dentry = dentry;
 	file.f_pos = 0;
 	file.f_reada = 0;
 	file.f_op = inode->i_op->default_file_ops;
@@ -214,7 +217,6 @@
 /* Finally dump the task struct.  Not be used by gdb, but could be useful */
 	set_fs(KERNEL_DS);
 	DUMP_WRITE(current,sizeof(*current));
-	inode->i_status |= ST_MODIFIED;
 close_coredump:
 	if (file.f_op->release)
 		file.f_op->release(inode,&file);
@@ -222,7 +224,7 @@
 	put_write_access(inode);
 end_coredump:
 	set_fs(fs);
-	iput(inode);
+	dput(dentry);
 	return has_dumped;
 }
 
@@ -318,7 +320,7 @@
 	if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
 	     N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
 	    N_TRSIZE(ex) || N_DRSIZE(ex) ||
-	    bprm->inode->i_size < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
+	    bprm->dentry->d_inode->i_size < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
 		return -ENOEXEC;
 	}
 
@@ -332,7 +334,7 @@
 	}
 
 	if (N_MAGIC(ex) == ZMAGIC && ex.a_text &&
-	    (fd_offset < bprm->inode->i_sb->s_blocksize)) {
+	    (fd_offset < bprm->dentry->d_inode->i_sb->s_blocksize)) {
 		printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n");
 		return -ENOEXEC;
 	}
@@ -372,12 +374,12 @@
 		error = do_mmap(NULL, N_TXTADDR(ex), ex.a_text,
 				PROT_READ|PROT_WRITE|PROT_EXEC,
 				MAP_FIXED|MAP_PRIVATE, 0);
-		read_exec(bprm->inode, fd_offset, (char *) N_TXTADDR(ex),
+		read_exec(bprm->dentry, fd_offset, (char *) N_TXTADDR(ex),
 			  ex.a_text, 0);
 		error = do_mmap(NULL, N_DATADDR(ex), ex.a_data,
 				PROT_READ|PROT_WRITE|PROT_EXEC,
 				MAP_FIXED|MAP_PRIVATE, 0);
-		read_exec(bprm->inode, fd_offset + ex.a_text, (char *) N_DATADDR(ex),
+		read_exec(bprm->dentry, fd_offset + ex.a_text, (char *) N_DATADDR(ex),
 			  ex.a_data, 0);
 		goto beyond_if;
 	}
@@ -389,20 +391,20 @@
 			ex.a_text+ex.a_data + PAGE_SIZE - 1,
 			PROT_READ|PROT_WRITE|PROT_EXEC,
 			MAP_FIXED|MAP_PRIVATE, 0);
-		read_exec(bprm->inode, fd_offset, (char *) N_TXTADDR(ex),
+		read_exec(bprm->dentry, fd_offset, (char *) N_TXTADDR(ex),
 			  ex.a_text+ex.a_data, 0);
 #else
 		do_mmap(NULL, 0, ex.a_text+ex.a_data,
 			PROT_READ|PROT_WRITE|PROT_EXEC,
 			MAP_FIXED|MAP_PRIVATE, 0);
-		read_exec(bprm->inode, 32, (char *) 0, ex.a_text+ex.a_data, 0);
+		read_exec(bprm->dentry, 32, (char *) 0, ex.a_text+ex.a_data, 0);
 #endif
 	} else {
 		if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
 		    (N_MAGIC(ex) != NMAGIC))
 			printk(KERN_NOTICE "executable not page aligned\n");
 
-		fd = open_inode(bprm->inode, O_RDONLY);
+		fd = open_dentry(bprm->dentry, O_RDONLY);
 
 		if (fd < 0)
 			return fd;
@@ -412,7 +414,7 @@
 			do_mmap(NULL, 0, ex.a_text+ex.a_data,
 				PROT_READ|PROT_WRITE|PROT_EXEC,
 				MAP_FIXED|MAP_PRIVATE, 0);
-			read_exec(bprm->inode, fd_offset,
+			read_exec(bprm->dentry, fd_offset,
 				  (char *) N_TXTADDR(ex), ex.a_text+ex.a_data, 0);
 			goto beyond_if;
 		}
@@ -482,17 +484,20 @@
 {
         struct file * file;
 	struct exec ex;
-	struct  inode * inode;
+	struct dentry * dentry;
+	struct inode * inode;
 	unsigned int len;
 	unsigned int bss;
 	unsigned int start_addr;
 	unsigned long error;
 
 	file = current->files->fd[fd];
-	inode = file->f_inode;
 
 	if (!file || !file->f_op)
 		return -EACCES;
+
+	dentry = file->f_dentry;
+	inode = dentry->d_inode;
 
 	/* Seek into the file */
 	if (file->f_op->llseek) {

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