ecryptfs: avoid ctx initialization race
authorKees Cook <keescook@chromium.org>
Tue, 13 Aug 2013 22:02:27 +0000 (15:02 -0700)
committerTyler Hicks <tyhicks@canonical.com>
Fri, 6 Sep 2013 23:58:18 +0000 (16:58 -0700)
commitcb69f36ba1f8d5e73c46538e84a88178fb17f23d
treedf95c5e4d7c9697d22d21653571cc2f5960b5256
parente6cbd6a44d8e263073808da9f295e502d15dc3fe
ecryptfs: avoid ctx initialization race

It might be possible for two callers to race the mutex lock after the
NULL ctx check. Instead, move the lock above the check so there isn't
the possibility of leaking a crypto ctx. Additionally, report the full
algo name when failing.

Signed-off-by: Kees Cook <keescook@chromium.org>
[tyhicks: remove out label, which is no longer used]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
fs/ecryptfs/crypto.c