diff options
author | Tejun Heo <tj@kernel.org> | 2011-11-24 19:22:24 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-11-24 19:22:24 -0500 |
commit | 4c81f045c0bd2cbb78cc6446a4cd98038fe11a2e (patch) | |
tree | d294fc2e46351d7ceb7b8d8b343cb5e6aabbcc18 /fs/ext4 | |
parent | caca6a03d365883564885f2c1da3e88dcf65d139 (diff) |
ext4: fix racy use-after-free in ext4_end_io_dio()
ext4_end_io_dio() queues io_end->work and then clears iocb->private;
however, io_end->work calls aio_complete() which frees the iocb
object. If that slab object gets reallocated, then ext4_end_io_dio()
can end up clearing someone else's iocb->private, this use-after-free
can cause a leak of a struct ext4_io_end_t structure.
Detected and tested with slab poisoning.
[ Note: Can also reproduce using 12 fio's against 12 file systems with the
following configuration file:
[global]
direct=1
ioengine=libaio
iodepth=1
bs=4k
ba=4k
size=128m
[create]
filename=${TESTDIR}
rw=write
-- tytso ]
Google-Bug-Id: 5354697
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Kent Overstreet <koverstreet@google.com>
Tested-by: Kent Overstreet <koverstreet@google.com>
Cc: stable@kernel.org
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index fffec40d5996..848f436df29f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2807,8 +2807,8 @@ out: | |||
2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
2808 | 2808 | ||
2809 | /* queue the work to convert unwritten extents to written */ | 2809 | /* queue the work to convert unwritten extents to written */ |
2810 | queue_work(wq, &io_end->work); | ||
2811 | iocb->private = NULL; | 2810 | iocb->private = NULL; |
2811 | queue_work(wq, &io_end->work); | ||
2812 | 2812 | ||
2813 | /* XXX: probably should move into the real I/O completion handler */ | 2813 | /* XXX: probably should move into the real I/O completion handler */ |
2814 | inode_dio_done(inode); | 2814 | inode_dio_done(inode); |