diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2015-09-21 09:43:06 +0200 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-09-21 07:27:35 -0400 |
commit | 128a37852234c1bd68eee4e7447f5362778009b8 (patch) | |
tree | 8f03feb85b58f1de45dff01387ac2736fc971585 /fs/befs/super.c | |
parent | d11797a0a7acc1fe6a51b1605e166adad04da29b (diff) | |
download | linux-128a37852234c1bd68eee4e7447f5362778009b8.tar.bz2 |
fs: fix data races on inode->i_flctx
locks_get_lock_context() uses cmpxchg() to install i_flctx.
cmpxchg() is a release operation which is correct. But it uses
a plain load to load i_flctx. This is incorrect. Subsequent loads
from i_flctx can hoist above the load of i_flctx pointer itself
and observe uninitialized garbage there. This in turn can lead
to corruption of ctx->flc_lock and other members.
Documentation/memory-barriers.txt explicitly requires to use
a barrier in such context:
"A load-load control dependency requires a full read memory barrier".
Use smp_load_acquire() in locks_get_lock_context() and in bunch
of other functions that can proceed concurrently with
locks_get_lock_context().
The data race was found with KernelThreadSanitizer (KTSAN).
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/befs/super.c')
0 files changed, 0 insertions, 0 deletions