diff options
author | Pan Bian <bianpan2016@163.com> | 2018-11-30 14:10:54 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-17 09:24:41 +0100 |
commit | a31da26a15e9656931fea29c28dcf9fa10db3f46 (patch) | |
tree | b278d42c71f75ea0183b5ae007a60dfcc28c84d8 /fs/ocfs2 | |
parent | 2a5d5f5f47b92a08e869471431f29b2b0090455e (diff) | |
download | linux-stable-a31da26a15e9656931fea29c28dcf9fa10db3f46.tar.gz linux-stable-a31da26a15e9656931fea29c28dcf9fa10db3f46.tar.bz2 linux-stable-a31da26a15e9656931fea29c28dcf9fa10db3f46.zip |
ocfs2: fix potential use after free
[ Upstream commit 164f7e586739d07eb56af6f6d66acebb11f315c8 ]
ocfs2_get_dentry() calls iput(inode) to drop the reference count of
inode, and if the reference count hits 0, inode is freed. However, in
this function, it then reads inode->i_generation, which may result in a
use after free bug. Move the put operation later.
Link: http://lkml.kernel.org/r/1543109237-110227-1-git-send-email-bianpan2016@163.com
Fixes: 781f200cb7a("ocfs2: Remove masklog ML_EXPORT.")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/export.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 9f88188060db..4bf8d5854b27 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -125,10 +125,10 @@ check_err: check_gen: if (handle->ih_generation != inode->i_generation) { - iput(inode); trace_ocfs2_get_dentry_generation((unsigned long long)blkno, handle->ih_generation, inode->i_generation); + iput(inode); result = ERR_PTR(-ESTALE); goto bail; } |