ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path
If ->follow_link handler returns an error, it should decrement nd->path refcnt. But ocfs2_fast_follow_link() doesn't decrement. This patch fixes the problem by using nd_set_link() style error handling instead of playing with nd->path. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Joel Becker <joel.becker@oracle.com>
This commit is contained in:
parent
1b4d40a517
commit
1dd473fdf1
|
@ -137,19 +137,19 @@ static void *ocfs2_fast_follow_link(struct dentry *dentry,
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
char *link = nd_get_link(nd);
|
||||
if (!IS_ERR(link))
|
||||
kfree(link);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue