tpm: fix double write race and tpm_release free issue
authorKent Yoder <key@linux.vnet.ibm.com>
Wed, 25 Jul 2012 19:14:02 +0000 (14:14 -0500)
committerKent Yoder <key@linux.vnet.ibm.com>
Wed, 22 Aug 2012 16:11:49 +0000 (11:11 -0500)
commitdd7da132f7f04f34074efd134847a818ea29ddd7
tree79448a7b8ccfb8531fbec1f241a853b2b911baa9
parent578b016fdc91464c08c096f0c5952cae549fdb8f
tpm: fix double write race and tpm_release free issue

Moved the atomic_set of the data_pending variable until after the
tpm_read has completed processing. The existing code had a window of
time where a second write to the driver could clobber the tpm command
buffer.

Also fixed an issue where if close was called on the tpm device before a
read completed, the tpm command buffer would be returned to the OS,
which could contain sensitive information.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
drivers/char/tpm/tpm.c