[GFS2] BZ 217008 fsfuzzer fix.
authorRussell Cattelan <cattelan@redhat.com>
Mon, 8 Jan 2007 23:47:51 +0000 (17:47 -0600)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 5 Feb 2007 18:36:28 +0000 (13:36 -0500)
Update the quilt header comments to match the
code changes.

Change gfs2_lookup_simple to return an error in the case
of a NULL inode.
The callers of gfs2_lookup_simple do not check for NULL
in the no entry case and such would end up dereferencing a NULL ptr.

This fixes:
http://projects.info-pull.com/mokb/MOKB-15-11-2006.html

Signed-off-by: Russell Cattelan <cattelan@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/inode.c

index 6bc443644c3c5bd3f4e825c2db4bca5abf9df628..bab338f6b6109496a0aed69478275b0144920a03 100644 (file)
@@ -361,8 +361,18 @@ out:
 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
 {
        struct qstr qstr;
+       struct inode *inode;
        gfs2_str2qstr(&qstr, name);
-       return gfs2_lookupi(dip, &qstr, 1, NULL);
+       inode = gfs2_lookupi(dip, &qstr, 1, NULL);
+       /* gfs2_lookupi has inconsistent callers: vfs
+        * related routines expect NULL for no entry found,
+        * gfs2_lookup_simple callers expect ENOENT
+        * and do not check for NULL.
+        */
+       if (inode == NULL)
+               return ERR_PTR(-ENOENT);
+       else
+               return inode;
 }