From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH] procfs: Fix refcnt leak on proc_self_follow_link() error path
Date: Tue, 12 Jan 2010 03:38:36 +0900 [thread overview]
Message-ID: <87aawkjxlf.fsf@devron.myhome.or.jp> (raw)
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>
next reply other threads:[~2010-01-11 18:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 18:38 OGAWA Hirofumi [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87aawkjxlf.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome