diff options
author | hujianyang <hujianyang@huawei.com> | 2014-04-30 14:06:06 +0800 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-05-13 13:45:15 +0300 |
commit | 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 (patch) | |
tree | f90a131981d969b002dd004590ac72efe007e990 /CREDITS | |
parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) | |
download | linux-691a7c6f28ac90cccd0dbcf81348ea90b211bdd0.tar.gz linux-691a7c6f28ac90cccd0dbcf81348ea90b211bdd0.tar.bz2 linux-691a7c6f28ac90cccd0dbcf81348ea90b211bdd0.zip |
UBIFS: fix an mmap and fsync race condition
There is a race condition in UBIFS:
Thread A (mmap) Thread B (fsync)
->__do_fault ->write_cache_pages
-> ubifs_vm_page_mkwrite
-> budget_space
-> lock_page
-> release/convert_page_budget
-> SetPagePrivate
-> TestSetPageDirty
-> unlock_page
-> lock_page
-> TestClearPageDirty
-> ubifs_writepage
-> do_writepage
-> release_budget
-> ClearPagePrivate
-> unlock_page
-> !(ret & VM_FAULT_LOCKED)
-> lock_page
-> set_page_dirty
-> ubifs_set_page_dirty
-> TestSetPageDirty (set page dirty without budgeting)
-> unlock_page
This leads to situation where we have a diry page but no budget allocated for
this page, so further write-back may fail with -ENOSPC.
In this fix we return from page_mkwrite without performing unlock_page. We
return VM_FAULT_LOCKED instead. After doing this, the race above will not
happen.
Signed-off-by: hujianyang <hujianyang@huawei.com>
Tested-by: Laurence Withers <lwithers@guralp.com>
Cc: stable@vger.kernel.org
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'CREDITS')
0 files changed, 0 insertions, 0 deletions