patch for 2.1.48 fs/ext2/namei.c

Bill Hawes (whawes@star.net)
Thu, 07 Aug 1997 15:43:59 -0400


This is a multi-part message in MIME format.
--------------B10574879F86A6DE95D27BD0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

There are several error exits in ext2_new_inode that don't set an error
return code, so that it's possible for ext2_create et al to falsely
indicate a successful return without having done a d_instantiate. This
could lead to problems later on ... I think some recent oops reports
might be related.

The attached patch fixes this by using -EIO as a default error, though
it would be better to get Stephen Tweedie to move his ext2 error patch
forward to 2.1.48.

Regards,
Bill
--------------B10574879F86A6DE95D27BD0
Content-Type: text/plain; charset=us-ascii; name="ext2_namei48-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="ext2_namei48-patch"

--- fs/ext2/namei.c.old Tue Aug 5 10:46:00 1997
+++ fs/ext2/namei.c Thu Aug 7 15:29:41 1997
@@ -351,10 +351,13 @@
struct inode * inode;
struct buffer_head * bh;
struct ext2_dir_entry * de;
- int err;
+ int err = -EIO;

if (!dir)
return -ENOENT;
+ /*
+ * N.B. Several error exits in ext2_new_inode don't set err.
+ */
inode = ext2_new_inode (dir, mode, &err);
if (!inode)
return err;
@@ -386,7 +389,7 @@
struct inode * inode;
struct buffer_head * bh;
struct ext2_dir_entry * de;
- int err;
+ int err = -EIO;

if (!dir)
return -ENOENT;
@@ -443,7 +446,7 @@
struct inode * inode;
struct buffer_head * bh, * dir_block;
struct ext2_dir_entry * de;
- int err;
+ int err = -EIO;

if (dentry->d_name.len > EXT2_NAME_LEN)
return -ENAMETOOLONG;
@@ -714,8 +717,7 @@
struct inode * inode = NULL;
struct buffer_head * bh = NULL, * name_block = NULL;
char * link;
- int i, err;
- int l;
+ int i, l, err = -EIO;
char c;

if (!(inode = ext2_new_inode (dir, S_IFLNK, &err))) {

--------------B10574879F86A6DE95D27BD0--