key_reject_and_link() marking a key as negative and setting the error with
which it was negated races with keyring searches and other things that read
that error.
The fix is to switch the order in which the assignments are done in
key_reject_and_link() and to use memory barriers.
Kudos to Dave Wysochanski <dwysocha@redhat.com> and Scott Mayhew
<smayhew@redhat.com> for tracking this down.
This may be the cause of:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000070
IP: [<ffffffff81219011>] wait_for_key_construction+0x31/0x80
PGD c6b2c3067 PUD c59879067 PMD 0
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/cpu3/cache/index2/shared_cpu_map
CPU 0
Modules linked in: ...