* [PATCH] ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path
@ 2010-01-11 18:37 OGAWA Hirofumi
2010-01-12 0:38 ` Joel Becker
0 siblings, 1 reply; 2+ messages in thread
From: OGAWA Hirofumi @ 2010-01-11 18:37 UTC (permalink / raw)
To: Mark Fasheh, Joel Becker; +Cc: ocfs2-devel, linux-kernel, linux-fsdevel
If ->follow_link handler return the error, it should decrement
nd->path refcnt. But, ocfs2_fast_follow_link() doesn't decrement.
This patch fix it by using usual nd_set_link() style error handling,
instead of playing with nd->path.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/ocfs2/symlink.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff -puN fs/ocfs2/symlink.c~namei-ocfs2-follow_link-fix fs/ocfs2/symlink.c
--- linux-2.6/fs/ocfs2/symlink.c~namei-ocfs2-follow_link-fix 2010-01-12 00:15:14.000000000 +0900
+++ linux-2.6-hirofumi/fs/ocfs2/symlink.c 2010-01-12 00:15:14.000000000 +0900
@@ -137,20 +137,20 @@ static void *ocfs2_fast_follow_link(stru
}
memcpy(link, target, len);
- nd_set_link(nd, link);
bail:
+ nd_set_link(nd, status ? ERR_PTR(status) : link);
brelse(bh);
mlog_exit(status);
- return status ? ERR_PTR(status) : link;
+ return NULL;
}
static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
{
- char *link = cookie;
-
- kfree(link);
+ char *link = nd_get_link(nd);
+ if (!IS_ERR(link))
+ kfree(link);
}
const struct inode_operations ocfs2_symlink_inode_operations = {
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path
2010-01-11 18:37 [PATCH] ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path OGAWA Hirofumi
@ 2010-01-12 0:38 ` Joel Becker
0 siblings, 0 replies; 2+ messages in thread
From: Joel Becker @ 2010-01-12 0:38 UTC (permalink / raw)
To: OGAWA Hirofumi; +Cc: Mark Fasheh, ocfs2-devel, linux-kernel, linux-fsdevel
On Tue, Jan 12, 2010 at 03:37:45AM +0900, OGAWA Hirofumi wrote:
>
> If ->follow_link handler return the error, it should decrement
> nd->path refcnt. But, ocfs2_fast_follow_link() doesn't decrement.
>
> This patch fix it by using usual nd_set_link() style error handling,
> instead of playing with nd->path.
>
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
This patch is now in the fixes branch of ocfs2.git.
Joel
--
"Against stupidity the Gods themselves contend in vain."
- Friedrich von Schiller
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-12 0:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 18:37 [PATCH] ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path OGAWA Hirofumi
2010-01-12 0:38 ` Joel Becker
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).