aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-10-02 09:04:11 +1000
committerDave Chinner <david@fromorbit.com>2014-10-02 09:04:11 +1000
commite11bb8052c3f500e66142f33579cc054d691a8fb (patch)
treea0a569a145631d37bd629a9c8a156e49515de626 /fs/xfs/xfs_inode.c
parentxfs: Don't use xfs_buf_iowait in the delwri buffer code (diff)
downloadlinux-dev-e11bb8052c3f500e66142f33579cc054d691a8fb.tar.xz
linux-dev-e11bb8052c3f500e66142f33579cc054d691a8fb.zip
xfs: synchronous buffer IO needs a reference
When synchronous IO runs IO completion work, it does so without an IO reference or a hold reference on the buffer. The IO "hold reference" is owned by the submitter, and released when the submission is complete. The IO reference is released when both the submitter and the bio end_io processing is run, and so if the io completion work is run from IO completion context, it is run without an IO reference. Hence we can get the situation where the submitter can submit the IO, see an error on the buffer and unlock and free the buffer while there is still IO in progress. This leads to use-after-free and memory corruption. Fix this by taking a "sync IO hold" reference that is owned by the IO and not released until after the buffer completion calls are run to wake up synchronous waiters. This means that the buffer will not be freed in any circumstance until all IO processing is completed. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
0 files changed, 0 insertions, 0 deletions