summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-10-01 23:04:11 (GMT)
committerDave Chinner <david@fromorbit.com>2014-10-01 23:04:11 (GMT)
commite11bb8052c3f500e66142f33579cc054d691a8fb (patch)
treea0a569a145631d37bd629a9c8a156e49515de626 /fs/namei.c
parentcf53e99d192171a58791136d33fd3fea5d8bab35 (diff)
downloadlinux-e11bb8052c3f500e66142f33579cc054d691a8fb.tar.xz
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/namei.c')
0 files changed, 0 insertions, 0 deletions