path: root/mm
diff options
authorJason A. Donenfeld <>2017-06-15 00:45:26 +0200
committerTheodore Ts'o <>2017-06-19 21:42:49 -0400
commit4a072c71f49b0a0e495ea13423bdb850da73c58c (patch)
tree6aacee17db1b1619926d0856d7cf74ef22470fdf /mm
parentb169c13de473a85b3c859bb36216a4cb5f00a54a (diff)
random: silence compiler warnings and fix race
Odd versions of gcc for the sh4 architecture will actually warn about flags being used while uninitialized, so we set them to zero. Non crazy gccs will optimize that out again, so it doesn't make a difference. Next, over aggressive gccs could inline the expression that defines use_lock, which could then introduce a race resulting in a lock imbalance. By using READ_ONCE, we prevent that fate. Finally, we make that assignment const, so that gcc can still optimize a nice amount. Finally, we fix a potential deadlock between primary_crng.lock and batched_entropy_reset_lock, where they could be called in opposite order. Moving the call to invalidate_batched_entropy to outside the lock rectifies this issue. Fixes: b169c13de473a85b3c859bb36216a4cb5f00a54a Signed-off-by: Jason A. Donenfeld <> Signed-off-by: Theodore Ts'o <> Cc:
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions