public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	jmoriss@namei.org, serue@linux.vnet.ibm.com,
	zohar@linux.vnet.ibm.com, safford@watson.ibm.com,
	paulmck@linux.vnet.ibm.com, debora@linux.vnet.ibm.com
Subject: Re: [PATCH 1/4] TPM: update char dev BKL pushdown
Date: Wed, 24 Sep 2008 10:14:40 -0300	[thread overview]
Message-ID: <1222262080.24276.32.camel@blackbox> (raw)
In-Reply-To: <20080923145807.63f9b904@bike.lwn.net>

On Tue, 2008-09-23 at 14:58 -0600, Jonathan Corbet wrote:
> On Tue, 23 Sep 2008 14:19:26 -0300
> Rajiv Andrade <srajiv@linux.vnet.ibm.com> wrote:
> 
> > + * It's assured that the chip will be opened just once,
> > + * by the check of is_open variable, which is protected
> > + * by driver_lock.
> 
> Taking a look at the code, I'm convinced.  BKL removal seems
> appropriate.
> 
> While I was in the neighborhood, though, something caught my eye:
> 
> int tpm_release(struct inode *inode, struct file *file)
> {
> 	struct tpm_chip *chip = file->private_data;
> 
> 	flush_scheduled_work();
> 
> Here you have waited until you've got nothing in the workqueue.
> 
> 	spin_lock(&driver_lock);
> 	file->private_data = NULL;
> 	del_singleshot_timer_sync(&chip->user_read_timer);
> 
> But, until you get here, your timer could have resubmitted a job into
> the workqueue - job which could run after you've freed "chip" and
> forgotten all about it. I think you need either a "don't resubmit" flag,
> or you need to delete the timer first.
> 
> jon

Yes, like in tpm_read(), the timer must be deleted before
flush_scheduled_work(). Since it's a fix to a new issue, I'm going to
submit a another patch.

Thanks,
Rajiv Andrade
IBM Linux Technology Center
Security Development


  reply	other threads:[~2008-09-24 13:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 17:19 [PATCH 0/4] BKL removed, RCU addition and pnp remove Rajiv Andrade
2008-09-23 17:19 ` [PATCH 1/4] TPM: update char dev BKL pushdown Rajiv Andrade
2008-09-23 20:58   ` Jonathan Corbet
2008-09-24 13:14     ` Rajiv Andrade [this message]
2008-09-23 17:19 ` [PATCH 2/4] TPM: num_opens to is_open variable change Rajiv Andrade
2008-09-23 17:19 ` [PATCH 3/4] TPM: rcu locking Rajiv Andrade
2008-09-23 18:19   ` Paul E. McKenney
2008-09-23 20:18     ` Rajiv Andrade
2008-09-23 20:27       ` Paul E. McKenney
2008-09-25 13:36         ` Serge E. Hallyn
2008-09-25 14:33           ` Paul E. McKenney
2008-09-25 14:59             ` Serge E. Hallyn
2008-09-23 20:19     ` [PATCH 3/4][resubmit] " Rajiv Andrade
2008-09-23 21:01       ` Jonathan Corbet
2008-09-23 21:27         ` Mimi Zohar
2008-09-24 13:10       ` Rajiv Andrade
2008-09-25 13:39         ` Serge E. Hallyn
2008-09-25 13:29   ` [PATCH 3/4] " Serge E. Hallyn
2008-09-23 17:19 ` [PATCH 4/4] TPM: addition of pnp remove Rajiv Andrade
2008-09-23 17:38   ` about kernel_physical_mapping_init Joilnen Leite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1222262080.24276.32.camel@blackbox \
    --to=srajiv@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=debora@linux.vnet.ibm.com \
    --cc=jmoriss@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=safford@watson.ibm.com \
    --cc=serue@linux.vnet.ibm.com \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox