| To: | Al Viro <viro@xxxxxxxxxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH 3/4] ocfs2: Fix possible use-after-free with AIO |
| From: | Jan Kara <jack@xxxxxxx> |
| Date: | Wed, 30 Jan 2013 00:28:00 +0100 |
| Cc: | linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx, Jan Kara <jack@xxxxxxx>, Joel Becker <jlbec@xxxxxxxxxxxx>, stable@xxxxxxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1359502081-20240-1-git-send-email-jack@xxxxxxx> |
| References: | <1359502081-20240-1-git-send-email-jack@xxxxxxx> |
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@xxxxxxxxxxxx>
CC: ocfs2-devel@xxxxxxxxxxxxxx
CC: stable@xxxxxxxxxxxxxxx
Acked-by: Jeff Moyer <jmoyer@xxxxxxxxxx>
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/4 v2] Fix possible use after free with AIO, Jan Kara |
|---|---|
| Next by Date: | [PATCH 2/4] xfs: Fix possible use-after-free with AIO, Jan Kara |
| Previous by Thread: | [PATCH 0/4 v2] Fix possible use after free with AIO, Jan Kara |
| Next by Thread: | [PATCH 2/4] xfs: Fix possible use-after-free with AIO, Jan Kara |
| Indexes: | [Date] [Thread] [Top] [All Lists] |