Skip to contentSkip to conversation

GFS2: Fix incorrect return code from gfs2_lookupi

PATCH In review Russell Cattelan 2 participants 2 messages Jan 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: Fix incorrect return code from gfs2_lookupi

This fixes a bug found by the fsfuzzer tool.
http://projects.info-pull.com/mokb/MOKB-15-11-2006.html

A NULL was not an acceptable error condition expected by any of the gfs2_lookupi callers.

Signature · 1 line
Russell Cattelan <[email protected]>

Change gfs2_lookupi to either return an inode or an error. None of the callers of gfs2_lookupi expect a NULL on error and such would end up dereferencing all NULL ptr.

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

fs/gfs2/inode.c +1 -1
Index: gfs2_crap/fs/gfs2/inode.c
===================================================================
@@ -419,7 +419,7 @@ struct inode *gfs2_lookupi(struct inode 
 out:
 	gfs2_glock_dq_uninit(&d_gh);
 	if (error == -ENOENT)
-		return NULL;
+		return ERR_PTR(error);
 	return inode;
 }