Thread (10 messages) 10 messages, 6 authors, 2013-01-31
STALE4870d REVIEWED: 1 (0M)
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH 3/4] ocfs2: Fix possible use-after-free with AIO

From: Jan Kara <jack@suse.cz>
Date: 2013-01-29 23:28:00
Also in: linux-fsdevel, linux-xfs, ocfs2-devel
Subsystem: filesystems (vfs and infrastructure), oracle cluster filesystem 2 (ocfs2), the rest · Maintainers: Alexander Viro, Christian Brauner, Mark Fasheh, Joel Becker, Joseph Qi, Linus Torvalds

Running AIO is pinning inode in memory using file reference. Once AIO
is completed using aio_complete(), file reference is put and inode can
be freed from memory. So we have to be sure that calling aio_complete()
is the last thing we do with the inode.

CC: Joel Becker <jlbec@evilplan.org>
CC: ocfs2-devel@oss.oracle.com
CC: stable@vger.kernel.org
Acked-by: Jeff Moyer <redacted>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/aops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 6577432..340bd02 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -593,9 +593,9 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
 	level = ocfs2_iocb_rw_locked_level(iocb);
 	ocfs2_rw_unlock(inode, level);
 
+	inode_dio_done(inode);
 	if (is_async)
 		aio_complete(iocb, ret, 0);
-	inode_dio_done(inode);
 }
 
 /*
-- 
1.7.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help