diff options
author | Eric Biggers | 2019-10-21 13:49:03 -0700 |
---|---|---|
committer | Eric Biggers | 2019-11-06 12:33:15 -0800 |
commit | ff73c2c016f8569b728eb1e9ebfab383545e4d65 (patch) | |
tree | 878f712c354b45c9d251da651ab4b3440e175ba2 /fs/crypto/fscrypt_private.h | |
parent | 065ab4c4701ff6e28785eb8172925fc3068cc15e (diff) |
fscrypt: avoid data race on fscrypt_mode::logged_impl_name
The access to logged_impl_name is technically a data race, which tools
like KCSAN could complain about in the future. See:
https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE
Fix by using xchg(), which also ensures that only one thread does the
logging.
This also required switching from bool to int, to avoid a build error on
the RISC-V architecture which doesn't implement xchg on bytes.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/crypto/fscrypt_private.h')
-rw-r--r-- | fs/crypto/fscrypt_private.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index dacf8fcbac3b..d9a3e8614049 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -435,7 +435,7 @@ struct fscrypt_mode { const char *cipher_str; int keysize; int ivsize; - bool logged_impl_name; + int logged_impl_name; }; static inline bool |