[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.0.82.0704230801230.6240@paragw-desktop>
Date: Mon, 23 Apr 2007 08:04:04 -0400 (EDT)
From: Parag Warudkar <parag.warudkar@...il.com>
To: Jiri Kosina <jikos@...os.cz>
cc: Andrew Morton <akpm@...ux-foundation.org>, dsk6@...t.edu,
pwarudkar@....com, linux-kernel@...r.kernel.org
Subject: Re: Sleep during spinlock in TPM driver
On Mon, 23 Apr 2007, Jiri Kosina wrote:
> On Sun, 22 Apr 2007, Parag Warudkar wrote:
>
>> @@ -1097,8 +1097,13 @@
>>
>> /* Driver specific per-device data */
>> chip = kzalloc(sizeof(*chip), GFP_KERNEL);
>> - if (chip == NULL)
>> + devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
>> + + if (chip == NULL || devname == NULL) {
>
> Hi,
>
> this line looks bogus to me.
>
Hi - Yep, thanks for catching. Really not sure how that extra + got in
there - I diffed the exact same file this morning and it isn't there - new
diff attached.
--- linux-2.6-us/drivers/char/tpm/tpm.c 2007-04-21 14:55:03.134975360 -0400
+++ linux-2.6-wk/drivers/char/tpm/tpm.c 2007-04-22 14:58:51.957999963 -0400
@@ -942,12 +942,12 @@
{
struct tpm_chip *chip = file->private_data;
+ flush_scheduled_work();
spin_lock(&driver_lock);
file->private_data = NULL;
- chip->num_opens--;
del_singleshot_timer_sync(&chip->user_read_timer);
- flush_scheduled_work();
atomic_set(&chip->data_pending, 0);
+ chip->num_opens--;
put_device(chip->dev);
kfree(chip->data_buffer);
spin_unlock(&driver_lock);
@@ -1097,8 +1097,13 @@
/* Driver specific per-device data */
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
- if (chip == NULL)
+ devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
+
+ if (chip == NULL || devname == NULL) {
+ kfree(chip);
+ kfree(devname);
return NULL;
+ }
init_MUTEX(&chip->buffer_mutex);
init_MUTEX(&chip->tpm_mutex);
@@ -1124,7 +1129,6 @@
set_bit(chip->dev_num, dev_mask);
- devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num);
chip->vendor.miscdev.name = devname;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists