Skip to content

Commit 2d2422a

Browse files
Christoph HellwigAlex Elder
Christoph Hellwig
authored and
Alex Elder
committed
xfs: fix a use after free in xfs_end_io_direct_write
There is a window in which the ioend that we call inode_dio_wake on in xfs_end_io_direct_write is already free. Fix this by storing the inode pointer in a local variable. This is a fix for the regression introduced in 3.1-rc by "fs: move inode_dio_done to the end_io handler". Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Alex Elder <[email protected]>
1 parent 003f6c9 commit 2d2422a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/xfs/xfs_aops.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,7 @@ xfs_end_io_direct_write(
13001300
bool is_async)
13011301
{
13021302
struct xfs_ioend *ioend = iocb->private;
1303+
struct inode *inode = ioend->io_inode;
13031304

13041305
/*
13051306
* blockdev_direct_IO can return an error even after the I/O
@@ -1331,7 +1332,7 @@ xfs_end_io_direct_write(
13311332
}
13321333

13331334
/* XXX: probably should move into the real I/O completion handler */
1334-
inode_dio_done(ioend->io_inode);
1335+
inode_dio_done(inode);
13351336
}
13361337

13371338
STATIC ssize_t

0 commit comments

Comments
 (0)