android_kernel_xiaomi_sdm845/drivers/char/tpm
Parag Warudkar 8e39c933b1 tpm: fix sleep-in-spinlock
flush_scheduled_work() can sleep, and we're calling it under spinlock.

AFAICS, moving flush_scheduled_work before spin_lock() should not cause any
problems.

Reason being - The only thing that can race against tpm_release is tpm_open
(tpm_release is called when last reference to the file is closed and only
thing that can happen after that is tpm_open??) and tpm_open acquires
driver_lock and more over it bails out with EBUSY if chip->num_opens is
greater than 0.

I also moved chip->num_pending-- to after deleting timer and setting data
pending as it looks more correct for the paranoid although it probably doesn't
matter as it is guarded by driver_lock.  None the less this change should not
cause problems.

While I was at it I noticed a missing NULL check in tpm_register_hardware
which is fixed with this patch as well.

Signed-off-by: Parag Warudkar <parag.warudkar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:13 -07:00
..
Kconfig [PATCH] tpm: update module dependencies 2006-05-15 11:20:54 -07:00
Makefile [PATCH] tpm: driver for next generation TPM chips 2006-04-22 09:19:54 -07:00
tpm_atmel.c [PATCH] tpm: fix error handling 2006-10-11 11:14:22 -07:00
tpm_atmel.h Revert "[POWERPC] Rename get_property to of_get_property: drivers" 2007-04-26 22:24:31 +10:00
tpm_bios.c [PATCH] mark struct file_operations const 3 2007-02-12 09:48:45 -08:00
tpm_infineon.c tpm_infineon: add support for devices in mmio space 2007-05-08 11:15:02 -07:00
tpm_nsc.c [PATCH] tpm: fix error handling 2006-10-11 11:14:22 -07:00
tpm_tis.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
tpm.c tpm: fix sleep-in-spinlock 2007-05-08 11:15:13 -07:00
tpm.h PCI: Cleanup the includes of <linux/pci.h> 2007-05-02 19:02:35 -07:00