aboutsummaryrefslogtreecommitdiff
path: root/fs/direct-io.c
Commit message (Collapse)AuthorAgeFilesLines
* direct-io: Prevent NULL pointer access in submit_page_sectionAndreas Gruenbacher2017-11-061-1/+2
| | | | | | | | | | | | | | | | | commit 899f0429c7d3eed886406cd72182bee3b96aa1f9 upstream. In the code added to function submit_page_section by commit b1058b981, sdio->bio can currently be NULL when calling dio_bio_submit. This then leads to a NULL pointer access in dio_bio_submit, so check for a NULL bio in submit_page_section before trying to submit it instead. Fixes xfstest generic/250 on gfs2. Cc: stable@vger.kernel.org # v3.10+ Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Willy Tarreau <w@1wt.eu>
* leak in O_DIRECT readv past the EOFAl Viro2017-11-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In all versions from 2.5.62 to 3.15, on each iteration through the loop by iovec array in do_blockdev_direct_IO() we used to do this: sdio.head = 0; sdio.tail = 0; ... retval = do_direct_IO(dio, &sdio, &map_bh); if (retval) { dio_cleanup(dio, &sdio); break; } with another dio_cleanup() done after the loop, catching the situation when retval had been 0. Consider the situation when e.g. the 3rd iovec in 4-iovec array passed to readv() has crossed the EOF. do_direct_IO() returns 0 and buggers off *without* exhausting the page array. The loop proceeds to the next iovec without calling dio_cleanup() and resets sdio.head and sdio.tail. That reset of sdio.{head,tail} has prevented the eventual dio_cleanup() from seeing anything and the page reference end up leaking. Commit 7b2c99d15559 (new helper: iov_iter_get_pages()) in 3.16 had eliminated the loop by iovec array, along with sdio.head and sdio.tail resets. Backporting that is too much work - the minimal fix is simply to make sure that the only case when do_direct_IO() buggers off early without returning non-zero will not skip dio_cleanup(). The fix applies to all versions from 2.5.62 to 3.15. Reported-and-tested-by: Venki Pallipadi <venki@cohesity.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Willy Tarreau <w@1wt.eu>
* misc: replace __FUNCTION__ by __function__Moyster2017-09-231-1/+1
| | | | | result of : git grep -l '__FUNCTION__' | xargs sed -i 's/__FUNCTION__/__func__/g'
* non-ext4 portions of "direct-io: Implement generic deferred AIO completions"Theodore Ts'o2017-05-271-16/+69
| | | | | | Originally from 7b7a8665edd8db73 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* first commitMeizu OpenSource2016-08-151-0/+1342