All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-29 23:27 ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-ext4, ocfs2-devel, xfs


  Hi,

  since nobody seem to have picked up any of the patches (at least
nobody told me so), I've added acks I received to the patches and I'm
sending them to Al for merging. Al, can you please merge these? Thanks.

								Honza

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-29 23:27 ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-ext4, ocfs2-devel, xfs


  Hi,

  since nobody seem to have picked up any of the patches (at least
nobody told me so), I've added acks I received to the patches and I'm
sending them to Al for merging. Al, can you please merge these? Thanks.

								Honza

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 1/4] ext4: Fix possible use-after-free with AIO
  2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
  (?)
@ 2013-01-29 23:27   ` Jan Kara
  -1 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Theodore Ts'o, stable

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: linux-ext4@vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: stable@vger.kernel.org
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/inode.c   |    2 +-
 fs/ext4/page-io.c |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cbfe13b..ba06638 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2977,9 +2977,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
 	if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
 		ext4_free_io_end(io_end);
 out:
+		inode_dio_done(inode);
 		if (is_async)
 			aio_complete(iocb, ret, 0);
-		inode_dio_done(inode);
 		return;
 	}
 
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 0016fbc..b42d04f 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -103,14 +103,13 @@ static int ext4_end_io(ext4_io_end_t *io)
 			 "(inode %lu, offset %llu, size %zd, error %d)",
 			 inode->i_ino, offset, size, ret);
 	}
-	if (io->iocb)
-		aio_complete(io->iocb, io->result, 0);
-
-	if (io->flag & EXT4_IO_END_DIRECT)
-		inode_dio_done(inode);
 	/* Wake up anyone waiting on unwritten extent conversion */
 	if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten))
 		wake_up_all(ext4_ioend_wq(inode));
+	if (io->flag & EXT4_IO_END_DIRECT)
+		inode_dio_done(inode);
+	if (io->iocb)
+		aio_complete(io->iocb, io->result, 0);
 	return ret;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 1/4] ext4: Fix possible use-after-free with AIO
@ 2013-01-29 23:27   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: Theodore Ts'o, stable, xfs, linux-fsdevel, Jan Kara,
	linux-ext4, ocfs2-devel

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: linux-ext4@vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: stable@vger.kernel.org
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/inode.c   |    2 +-
 fs/ext4/page-io.c |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cbfe13b..ba06638 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2977,9 +2977,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
 	if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
 		ext4_free_io_end(io_end);
 out:
+		inode_dio_done(inode);
 		if (is_async)
 			aio_complete(iocb, ret, 0);
-		inode_dio_done(inode);
 		return;
 	}
 
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 0016fbc..b42d04f 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -103,14 +103,13 @@ static int ext4_end_io(ext4_io_end_t *io)
 			 "(inode %lu, offset %llu, size %zd, error %d)",
 			 inode->i_ino, offset, size, ret);
 	}
-	if (io->iocb)
-		aio_complete(io->iocb, io->result, 0);
-
-	if (io->flag & EXT4_IO_END_DIRECT)
-		inode_dio_done(inode);
 	/* Wake up anyone waiting on unwritten extent conversion */
 	if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten))
 		wake_up_all(ext4_ioend_wq(inode));
+	if (io->flag & EXT4_IO_END_DIRECT)
+		inode_dio_done(inode);
+	if (io->iocb)
+		aio_complete(io->iocb, io->result, 0);
 	return ret;
 }
 
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 1/4] ext4: Fix possible use-after-free with AIO
@ 2013-01-29 23:27   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Theodore Ts'o, stable

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: linux-ext4 at vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: stable at vger.kernel.org
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/inode.c   |    2 +-
 fs/ext4/page-io.c |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cbfe13b..ba06638 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2977,9 +2977,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
 	if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
 		ext4_free_io_end(io_end);
 out:
+		inode_dio_done(inode);
 		if (is_async)
 			aio_complete(iocb, ret, 0);
-		inode_dio_done(inode);
 		return;
 	}
 
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 0016fbc..b42d04f 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -103,14 +103,13 @@ static int ext4_end_io(ext4_io_end_t *io)
 			 "(inode %lu, offset %llu, size %zd, error %d)",
 			 inode->i_ino, offset, size, ret);
 	}
-	if (io->iocb)
-		aio_complete(io->iocb, io->result, 0);
-
-	if (io->flag & EXT4_IO_END_DIRECT)
-		inode_dio_done(inode);
 	/* Wake up anyone waiting on unwritten extent conversion */
 	if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten))
 		wake_up_all(ext4_ioend_wq(inode));
+	if (io->flag & EXT4_IO_END_DIRECT)
+		inode_dio_done(inode);
+	if (io->iocb)
+		aio_complete(io->iocb, io->result, 0);
 	return ret;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 2/4] xfs: Fix possible use-after-free with AIO
  2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
  (?)
@ 2013-01-29 23:27   ` Jan Kara
  -1 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara, Ben Myers, stable

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: xfs@oss.sgi.com
CC: Ben Myers <bpm@sgi.com>
CC: stable@vger.kernel.org
Reviewed-by: Ben Myers <bpm@sgi.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_aops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 4111a40..5f707e5 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -86,11 +86,11 @@ xfs_destroy_ioend(
 	}
 
 	if (ioend->io_iocb) {
+		inode_dio_done(ioend->io_inode);
 		if (ioend->io_isasync) {
 			aio_complete(ioend->io_iocb, ioend->io_error ?
 					ioend->io_error : ioend->io_result, 0);
 		}
-		inode_dio_done(ioend->io_inode);
 	}
 
 	mempool_free(ioend, xfs_ioend_pool);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 2/4] xfs: Fix possible use-after-free with AIO
@ 2013-01-29 23:27   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: Jan Kara, stable, xfs, Ben Myers, linux-fsdevel, linux-ext4, ocfs2-devel

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: xfs@oss.sgi.com
CC: Ben Myers <bpm@sgi.com>
CC: stable@vger.kernel.org
Reviewed-by: Ben Myers <bpm@sgi.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_aops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 4111a40..5f707e5 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -86,11 +86,11 @@ xfs_destroy_ioend(
 	}
 
 	if (ioend->io_iocb) {
+		inode_dio_done(ioend->io_inode);
 		if (ioend->io_isasync) {
 			aio_complete(ioend->io_iocb, ioend->io_error ?
 					ioend->io_error : ioend->io_result, 0);
 		}
-		inode_dio_done(ioend->io_inode);
 	}
 
 	mempool_free(ioend, xfs_ioend_pool);
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 2/4] xfs: Fix possible use-after-free with AIO
@ 2013-01-29 23:27   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:27 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara, Ben Myers, stable

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: xfs at oss.sgi.com
CC: Ben Myers <bpm@sgi.com>
CC: stable at vger.kernel.org
Reviewed-by: Ben Myers <bpm@sgi.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_aops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 4111a40..5f707e5 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -86,11 +86,11 @@ xfs_destroy_ioend(
 	}
 
 	if (ioend->io_iocb) {
+		inode_dio_done(ioend->io_inode);
 		if (ioend->io_isasync) {
 			aio_complete(ioend->io_iocb, ioend->io_error ?
 					ioend->io_error : ioend->io_result, 0);
 		}
-		inode_dio_done(ioend->io_inode);
 	}
 
 	mempool_free(ioend, xfs_ioend_pool);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 3/4] ocfs2: Fix possible use-after-free with AIO
  2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
  (?)
@ 2013-01-29 23:28   ` Jan Kara
  -1 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Joel Becker, stable

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 <jmoyer@redhat.com>
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


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 3/4] ocfs2: Fix possible use-after-free with AIO
@ 2013-01-29 23:28   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: Jan Kara, stable, xfs, Joel Becker, linux-fsdevel, linux-ext4,
	ocfs2-devel

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 <jmoyer@redhat.com>
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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 3/4] ocfs2: Fix possible use-after-free with AIO
@ 2013-01-29 23:28   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Joel Becker, stable

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 at oss.oracle.com
CC: stable at vger.kernel.org
Acked-by: Jeff Moyer <jmoyer@redhat.com>
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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 4/4] fs: Fix possible use-after-free with AIO
  2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
  (?)
@ 2013-01-29 23:28   ` Jan Kara
  -1 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Christoph Hellwig, Jens Axboe, Jeff Moyer, stable

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: Christoph Hellwig <hch@infradead.org>
CC: Jens Axboe <axboe@kernel.dk>
CC: Jeff Moyer <jmoyer@redhat.com>
CC: stable@vger.kernel.org
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/direct-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index cf5b44b..f853263 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
 		dio->end_io(dio->iocb, offset, transferred,
 			    dio->private, ret, is_async);
 	} else {
+		inode_dio_done(dio->inode);
 		if (is_async)
 			aio_complete(dio->iocb, ret, 0);
-		inode_dio_done(dio->inode);
 	}
 
 	return ret;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 4/4] fs: Fix possible use-after-free with AIO
@ 2013-01-29 23:28   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: Jens Axboe, Jan Kara, stable, xfs, Christoph Hellwig, Jeff Moyer,
	linux-fsdevel, linux-ext4, ocfs2-devel

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: Christoph Hellwig <hch@infradead.org>
CC: Jens Axboe <axboe@kernel.dk>
CC: Jeff Moyer <jmoyer@redhat.com>
CC: stable@vger.kernel.org
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/direct-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index cf5b44b..f853263 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
 		dio->end_io(dio->iocb, offset, transferred,
 			    dio->private, ret, is_async);
 	} else {
+		inode_dio_done(dio->inode);
 		if (is_async)
 			aio_complete(dio->iocb, ret, 0);
-		inode_dio_done(dio->inode);
 	}
 
 	return ret;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 4/4] fs: Fix possible use-after-free with AIO
@ 2013-01-29 23:28   ` Jan Kara
  0 siblings, 0 replies; 29+ messages in thread
From: Jan Kara @ 2013-01-29 23:28 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel, Jan Kara,
	Christoph Hellwig, Jens Axboe, Jeff Moyer, stable

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: Christoph Hellwig <hch@infradead.org>
CC: Jens Axboe <axboe@kernel.dk>
CC: Jeff Moyer <jmoyer@redhat.com>
CC: stable at vger.kernel.org
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/direct-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index cf5b44b..f853263 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
 		dio->end_io(dio->iocb, offset, transferred,
 			    dio->private, ret, is_async);
 	} else {
+		inode_dio_done(dio->inode);
 		if (is_async)
 			aio_complete(dio->iocb, ret, 0);
-		inode_dio_done(dio->inode);
 	}
 
 	return ret;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/4] xfs: Fix possible use-after-free with AIO
  2013-01-29 23:27   ` Jan Kara
  (?)
@ 2013-01-30  0:56     ` Ben Myers
  -1 siblings, 0 replies; 29+ messages in thread
From: Ben Myers @ 2013-01-30  0:56 UTC (permalink / raw)
  To: Jan Kara; +Cc: Al Viro, stable, xfs, linux-fsdevel, linux-ext4, ocfs2-devel

Hi Jan,

On Wed, Jan 30, 2013 at 12:27:59AM +0100, Jan Kara wrote:
> 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: xfs@oss.sgi.com
> CC: Ben Myers <bpm@sgi.com>
> CC: stable@vger.kernel.org
> Reviewed-by: Ben Myers <bpm@sgi.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

We picked this up in the xfs tree.  Sorry to keep you hanging.

Regards,
	Ben

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/4] xfs: Fix possible use-after-free with AIO
@ 2013-01-30  0:56     ` Ben Myers
  0 siblings, 0 replies; 29+ messages in thread
From: Ben Myers @ 2013-01-30  0:56 UTC (permalink / raw)
  To: Jan Kara; +Cc: stable, xfs, Al Viro, linux-fsdevel, linux-ext4, ocfs2-devel

Hi Jan,

On Wed, Jan 30, 2013 at 12:27:59AM +0100, Jan Kara wrote:
> 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: xfs@oss.sgi.com
> CC: Ben Myers <bpm@sgi.com>
> CC: stable@vger.kernel.org
> Reviewed-by: Ben Myers <bpm@sgi.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

We picked this up in the xfs tree.  Sorry to keep you hanging.

Regards,
	Ben

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 2/4] xfs: Fix possible use-after-free with AIO
@ 2013-01-30  0:56     ` Ben Myers
  0 siblings, 0 replies; 29+ messages in thread
From: Ben Myers @ 2013-01-30  0:57 UTC (permalink / raw)
  To: Jan Kara; +Cc: Al Viro, stable, xfs, linux-fsdevel, linux-ext4, ocfs2-devel

Hi Jan,

On Wed, Jan 30, 2013 at 12:27:59AM +0100, Jan Kara wrote:
> 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: xfs at oss.sgi.com
> CC: Ben Myers <bpm@sgi.com>
> CC: stable at vger.kernel.org
> Reviewed-by: Ben Myers <bpm@sgi.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

We picked this up in the xfs tree.  Sorry to keep you hanging.

Regards,
	Ben

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 1/4] ext4: Fix possible use-after-free with AIO
  2013-01-29 23:27   ` Jan Kara
  (?)
@ 2013-01-30  3:51     ` Theodore Ts'o
  -1 siblings, 0 replies; 29+ messages in thread
From: Theodore Ts'o @ 2013-01-30  3:51 UTC (permalink / raw)
  To: Jan Kara; +Cc: Al Viro, linux-fsdevel, xfs, linux-ext4, ocfs2-devel, stable

On Wed, Jan 30, 2013 at 12:27:58AM +0100, Jan Kara wrote:
> 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: linux-ext4@vger.kernel.org
> CC: "Theodore Ts'o" <tytso@mit.edu>
> CC: stable@vger.kernel.org
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

I've picked up the ext4 change.  Sorry for not getting to this sooner.

     	       	   		       	   - Ted


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 1/4] ext4: Fix possible use-after-free with AIO
@ 2013-01-30  3:51     ` Theodore Ts'o
  0 siblings, 0 replies; 29+ messages in thread
From: Theodore Ts'o @ 2013-01-30  3:51 UTC (permalink / raw)
  To: Jan Kara; +Cc: stable, xfs, Al Viro, linux-fsdevel, linux-ext4, ocfs2-devel

On Wed, Jan 30, 2013 at 12:27:58AM +0100, Jan Kara wrote:
> 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: linux-ext4@vger.kernel.org
> CC: "Theodore Ts'o" <tytso@mit.edu>
> CC: stable@vger.kernel.org
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

I've picked up the ext4 change.  Sorry for not getting to this sooner.

     	       	   		       	   - Ted

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 1/4] ext4: Fix possible use-after-free with AIO
@ 2013-01-30  3:51     ` Theodore Ts'o
  0 siblings, 0 replies; 29+ messages in thread
From: Theodore Ts'o @ 2013-01-30  3:51 UTC (permalink / raw)
  To: Jan Kara; +Cc: Al Viro, linux-fsdevel, xfs, linux-ext4, ocfs2-devel, stable

On Wed, Jan 30, 2013 at 12:27:58AM +0100, Jan Kara wrote:
> 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: linux-ext4 at vger.kernel.org
> CC: "Theodore Ts'o" <tytso@mit.edu>
> CC: stable at vger.kernel.org
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

I've picked up the ext4 change.  Sorry for not getting to this sooner.

     	       	   		       	   - Ted

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
  2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
  (?)
@ 2013-01-30 14:45   ` Al Viro
  -1 siblings, 0 replies; 29+ messages in thread
From: Al Viro @ 2013-01-30 14:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> 
>   Hi,
> 
>   since nobody seem to have picked up any of the patches (at least
> nobody told me so), I've added acks I received to the patches and I'm
> sending them to Al for merging. Al, can you please merge these? Thanks.

VFS part (4/4) picked; IMO at least ext* and xfs should go through the
filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
it as well - not sure how active their tree is these days...

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-30 14:45   ` Al Viro
  0 siblings, 0 replies; 29+ messages in thread
From: Al Viro @ 2013-01-30 14:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-ext4, ocfs2-devel, xfs

On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> 
>   Hi,
> 
>   since nobody seem to have picked up any of the patches (at least
> nobody told me so), I've added acks I received to the patches and I'm
> sending them to Al for merging. Al, can you please merge these? Thanks.

VFS part (4/4) picked; IMO at least ext* and xfs should go through the
filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
it as well - not sure how active their tree is these days...

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-30 14:45   ` Al Viro
  0 siblings, 0 replies; 29+ messages in thread
From: Al Viro @ 2013-01-30 14:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> 
>   Hi,
> 
>   since nobody seem to have picked up any of the patches (at least
> nobody told me so), I've added acks I received to the patches and I'm
> sending them to Al for merging. Al, can you please merge these? Thanks.

VFS part (4/4) picked; IMO at least ext* and xfs should go through the
filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
it as well - not sure how active their tree is these days...

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
  2013-01-30 14:45   ` Al Viro
  (?)
@ 2013-01-31  2:10     ` Li Zefan
  -1 siblings, 0 replies; 29+ messages in thread
From: Li Zefan @ 2013-01-31  2:10 UTC (permalink / raw)
  To: Al Viro; +Cc: Jan Kara, linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On 2013/1/30 22:45, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
>>
>>   Hi,
>>
>>   since nobody seem to have picked up any of the patches (at least
>> nobody told me so), I've added acks I received to the patches and I'm
>> sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

I would say just grab it.

We've been sending bug fixes to ocfs2 mailing list since Aug 2012, but none
was pushed into upstream.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-31  2:10     ` Li Zefan
  0 siblings, 0 replies; 29+ messages in thread
From: Li Zefan @ 2013-01-31  2:10 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-ext4, Jan Kara, ocfs2-devel, xfs

On 2013/1/30 22:45, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
>>
>>   Hi,
>>
>>   since nobody seem to have picked up any of the patches (at least
>> nobody told me so), I've added acks I received to the patches and I'm
>> sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

I would say just grab it.

We've been sending bug fixes to ocfs2 mailing list since Aug 2012, but none
was pushed into upstream.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-31  2:10     ` Li Zefan
  0 siblings, 0 replies; 29+ messages in thread
From: Li Zefan @ 2013-01-31  2:10 UTC (permalink / raw)
  To: Al Viro; +Cc: Jan Kara, linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On 2013/1/30 22:45, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
>>
>>   Hi,
>>
>>   since nobody seem to have picked up any of the patches (at least
>> nobody told me so), I've added acks I received to the patches and I'm
>> sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

I would say just grab it.

We've been sending bug fixes to ocfs2 mailing list since Aug 2012, but none
was pushed into upstream.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
  2013-01-30 14:45   ` Al Viro
  (?)
@ 2013-01-31 19:31     ` Joel Becker
  -1 siblings, 0 replies; 29+ messages in thread
From: Joel Becker @ 2013-01-31 19:31 UTC (permalink / raw)
  To: Al Viro; +Cc: Jan Kara, linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On Wed, Jan 30, 2013 at 02:45:35PM +0000, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> > 
> >   Hi,
> > 
> >   since nobody seem to have picked up any of the patches (at least
> > nobody told me so), I've added acks I received to the patches and I'm
> > sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

	I thought akpm had this through -mm.  I acked it there.

Joel

> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

"Same dancers in the same old shoes.
 You get too careful with the steps you choose.
 You don't care about winning but you don't want to lose
 After the thrill is gone."

			http://www.jlbec.org/
			jlbec@evilplan.org

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-31 19:31     ` Joel Becker
  0 siblings, 0 replies; 29+ messages in thread
From: Joel Becker @ 2013-01-31 19:31 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-ext4, Jan Kara, ocfs2-devel, xfs

On Wed, Jan 30, 2013 at 02:45:35PM +0000, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> > 
> >   Hi,
> > 
> >   since nobody seem to have picked up any of the patches (at least
> > nobody told me so), I've added acks I received to the patches and I'm
> > sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

	I thought akpm had this through -mm.  I acked it there.

Joel

> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

"Same dancers in the same old shoes.
 You get too careful with the steps you choose.
 You don't care about winning but you don't want to lose
 After the thrill is gone."

			http://www.jlbec.org/
			jlbec@evilplan.org

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Ocfs2-devel] [PATCH 0/4 v2] Fix possible use after free with AIO
@ 2013-01-31 19:31     ` Joel Becker
  0 siblings, 0 replies; 29+ messages in thread
From: Joel Becker @ 2013-01-31 19:31 UTC (permalink / raw)
  To: Al Viro; +Cc: Jan Kara, linux-fsdevel, xfs, linux-ext4, ocfs2-devel

On Wed, Jan 30, 2013 at 02:45:35PM +0000, Al Viro wrote:
> On Wed, Jan 30, 2013 at 12:27:57AM +0100, Jan Kara wrote:
> > 
> >   Hi,
> > 
> >   since nobody seem to have picked up any of the patches (at least
> > nobody told me so), I've added acks I received to the patches and I'm
> > sending them to Al for merging. Al, can you please merge these? Thanks.
> 
> VFS part (4/4) picked; IMO at least ext* and xfs should go through the
> filesystem trees.  If ocfs2 folks don't pick fs/ocfs2 part, I'll grab
> it as well - not sure how active their tree is these days...

	I thought akpm had this through -mm.  I acked it there.

Joel

> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

"Same dancers in the same old shoes.
 You get too careful with the steps you choose.
 You don't care about winning but you don't want to lose
 After the thrill is gone."

			http://www.jlbec.org/
			jlbec at evilplan.org

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2013-01-31 19:32 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 23:27 [PATCH 0/4 v2] Fix possible use after free with AIO Jan Kara
2013-01-29 23:27 ` [Ocfs2-devel] " Jan Kara
2013-01-29 23:27 ` [PATCH 1/4] ext4: Fix possible use-after-free " Jan Kara
2013-01-29 23:27   ` [Ocfs2-devel] " Jan Kara
2013-01-29 23:27   ` Jan Kara
2013-01-30  3:51   ` Theodore Ts'o
2013-01-30  3:51     ` [Ocfs2-devel] " Theodore Ts'o
2013-01-30  3:51     ` Theodore Ts'o
2013-01-29 23:27 ` [PATCH 2/4] xfs: " Jan Kara
2013-01-29 23:27   ` [Ocfs2-devel] " Jan Kara
2013-01-29 23:27   ` Jan Kara
2013-01-30  0:56   ` Ben Myers
2013-01-30  0:57     ` [Ocfs2-devel] " Ben Myers
2013-01-30  0:56     ` Ben Myers
2013-01-29 23:28 ` [PATCH 3/4] ocfs2: " Jan Kara
2013-01-29 23:28   ` [Ocfs2-devel] " Jan Kara
2013-01-29 23:28   ` Jan Kara
2013-01-29 23:28 ` [PATCH 4/4] fs: " Jan Kara
2013-01-29 23:28   ` [Ocfs2-devel] " Jan Kara
2013-01-29 23:28   ` Jan Kara
2013-01-30 14:45 ` [PATCH 0/4 v2] Fix possible use after free " Al Viro
2013-01-30 14:45   ` [Ocfs2-devel] " Al Viro
2013-01-30 14:45   ` Al Viro
2013-01-31  2:10   ` Li Zefan
2013-01-31  2:10     ` [Ocfs2-devel] " Li Zefan
2013-01-31  2:10     ` Li Zefan
2013-01-31 19:31   ` Joel Becker
2013-01-31 19:31     ` [Ocfs2-devel] " Joel Becker
2013-01-31 19:31     ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.