linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] procfs: Fix refcnt leak on proc_self_follow_link() error path
@ 2010-01-11 18:38 OGAWA Hirofumi
  2010-01-13 19:43 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: OGAWA Hirofumi @ 2010-01-11 18:38 UTC (permalink / raw)
  To: Al Viro, Andrew Morton; +Cc: linux-kernel, linux-fsdevel


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

This patch fix it.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 fs/proc/base.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN fs/proc/base.c~namei-procfs-follow_link-fix fs/proc/base.c
--- linux-2.6/fs/proc/base.c~namei-procfs-follow_link-fix	2010-01-12 00:15:15.000000000 +0900
+++ linux-2.6-hirofumi/fs/proc/base.c	2010-01-12 00:15:15.000000000 +0900
@@ -2371,8 +2371,10 @@ static void *proc_self_follow_link(struc
 	struct pid_namespace *ns = dentry->d_sb->s_fs_info;
 	pid_t tgid = task_tgid_nr_ns(current, ns);
 	char tmp[PROC_NUMBUF];
-	if (!tgid)
+	if (!tgid) {
+		path_put(&nd->path);
 		return ERR_PTR(-ENOENT);
+	}
 	sprintf(tmp, "%d", task_tgid_nr_ns(current, ns));
 	return ERR_PTR(vfs_follow_link(nd,tmp));
 }
_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-04 19:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 18:38 [PATCH] procfs: Fix refcnt leak on proc_self_follow_link() error path OGAWA Hirofumi
2010-01-13 19:43 ` Al Viro
2010-01-14  0:25   ` Andrew Morton
2010-01-14  1:55     ` Al Viro
2010-02-04 19:31       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).