Pull fsverity update from Eric Biggers: "One fix for fs/verity/ to strengthen a memory barrier which might be too weak. This mirrors a similar fix in fs/crypto/" * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt: fs-verity: use smp_load_acquire() for ->i_verity_info
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -115,8 +115,13 @@ struct fsverity_operations { · 114 unmodified lines | |||
| 115 | 115 | ||
| 116 | static inline struct fsverity_info *fsverity_get_info(const struct inode *inode) | 116 | static inline struct fsverity_info *fsverity_get_info(const struct inode *inode) |
| 117 | { | 117 | { |
| 118 | /* pairs with the cmpxchg() in fsverity_set_info() */ | 118 | /* |
| 119 | return READ_ONCE(inode->i_verity_info); | 119 | * Pairs with the cmpxchg_release() in fsverity_set_info(). |
| 120 | * I.e., another task may publish ->i_verity_info concurrently, | ||
| 121 | * executing a RELEASE barrier. We need to use smp_load_acquire() here | ||
| 122 | * to safely ACQUIRE the memory the other task published. | ||
| 123 | */ | ||
| 124 | return smp_load_acquire(&inode->i_verity_info); | ||
| 120 | } | 125 | } |
| 121 | 126 | ||
| 122 | /* enable.c */ | 127 | /* enable.c */ |