Skip to contentSkip to conversation

gfs2: Fix refcnt leak on gfs2_follow_link() error path

PATCH In review OGAWA Hirofumi 2 participants 2 messages Jan 11, 2010 – Jan 12, 2010

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

PATCH 1/1 gfs2: Fix refcnt leak on gfs2_follow_link() error path

If ->follow_link handler return the error, it should decrement nd->path refcnt.

This patch fix it.

---

 fs/gfs2/ops_inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/ops_inode.c renamed from fs/gfs2/ops_inode.c~namei-gfs2-follow_link-fix +2 -1
diff -puN fs/gfs2/ops_inode.c~namei-gfs2-follow_link-fix fs/gfs2/ops_inode.c
@@ -1086,7 +1086,8 @@ static void *gfs2_follow_link(struct den
 		error = vfs_follow_link(nd, buf);
 		if (buf != array)
 			kfree(buf);
-	}
+	} else
+		path_put(&nd->path);
 
 	return ERR_PTR(error);
 }

_

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#1 lore raw

Hi,

Thanks for the patch. I've pushed it into the GFS2 -fixes tree,

Steve.

Quoted 26 lines · OGAWA Hirofumi

If ->follow_link handler return the error, it should decrement nd->path refcnt.

This patch fix it.

---

 fs/gfs2/ops_inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/gfs2/ops_inode.c~namei-gfs2-follow_link-fix fs/gfs2/ops_inode.c

fs/gfs2/ops_inode.c renamed from fs/gfs2/ops_inode.c~namei-gfs2-follow_link-fix +2 -1
@@ -1086,7 +1086,8 @@ static void *gfs2_follow_link(struct den
 		error = vfs_follow_link(nd, buf);
 		if (buf != array)
 			kfree(buf);
-	}
+	} else
+		path_put(&nd->path);
 
 	return ERR_PTR(error);
 }

_