From: Andrew Morton <akpm@li...> - 2007-04-21 22:51:12
On Fri, 20 Apr 2007 18:11:10 -0400 "David Kyle" <dsk6@...> wrote:
> I've been working with the TPM driver, and I found that if I opened,
> used, then closed the TPM char device very frequently, I would get a
> kernel BUG message saying that the kernel tried to sleep while holding
> a spinlock. I think I've isolated the problem to this function, in
> int tpm_release(struct inode *inode, struct file *file)
> struct tpm_chip *chip = file->private_data;
> file->private_data = NULL;
> atomic_set(&chip->data_pending, 0);
> return 0;
> I believe that flush_scheduled_work can sleep, correct? Does anyone
> know why this function is called while the spinlock is held?
yup, that's a bug. It's not immediately clear to e what driver_lock is
protecting. Some global things, some per-device things, it appears.
A suitable fix might be to make driver_lock a mutex.
Get latest updates about Open Source Projects, Conferences and News.