[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87aawkjxlf.fsf@devron.myhome.or.jp>
Date: Tue, 12 Jan 2010 03:38:36 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH] procfs: Fix refcnt leak on proc_self_follow_link() error path
If ->follow_link handler return the error, it should decrement
nd->path refcnt.
This patch fix it.
Signed-off-by: OGAWA Hirofumi <hirofumi@...l.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@...l.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists