All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Jeremiah Mahler <jmmahler@gmail.com>,
	Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	"moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@lists.sourceforge.net>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register()
Date: Tue, 10 Nov 2015 08:16:16 +0200	[thread overview]
Message-ID: <20151110061616.GA4404@intel.com> (raw)
In-Reply-To: <20151110061141.GB31052@localhost.localdomain>

On Mon, Nov 09, 2015 at 10:11:41PM -0800, Jeremiah Mahler wrote:
> Jarkko,
> 
> On Sun, Nov 08, 2015 at 09:51:07AM +0200, Jarkko Sakkinen wrote:
> > __compat_only_sysfs_link_entry_to_kobj() was unconditionally called for
> > TPM1 chips, which caused crash on Acer C720 laptop where DSM for the
> > ACPI object did not exist.
> > 
> > There are two reasons for unwanted behavior:
> > 
> > * The code did not check whether
> >   __compat_only_sysfs_link_entry_to_kobj() returned -ENOENT. This is
> >   OK. It just meanst that ppi is not available.
> > * The code did not clean up properly. Compat link should added only
> >   after all other init is done.
> > 
> > This patch sorts out these issues.
> > 
> > Fixes: 9b774d5cf2db
> > Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
> > ---
> >  drivers/char/tpm/tpm-chip.c | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index a5cdce7..45cc39a 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -226,14 +226,6 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  	if (rc)
> >  		goto out_err;
> >  
> > -	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > -		rc = __compat_only_sysfs_link_entry_to_kobj(&chip->pdev->kobj,
> > -							    &chip->dev.kobj,
> > -							    "ppi");
> > -		if (rc)
> > -			goto out_err;
> > -	}
> > -
> >  	/* Make the chip available. */
> >  	spin_lock(&driver_lock);
> >  	list_add_tail_rcu(&chip->list, &tpm_chip_list);
> > @@ -241,6 +233,16 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  
> >  	chip->flags |= TPM_CHIP_FLAG_REGISTERED;
> >  
> > +	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > +		rc = __compat_only_sysfs_link_entry_to_kobj(&chip->pdev->kobj,
> > +							    &chip->dev.kobj,
> > +							    "ppi");
> > +		if (rc && rc != -ENOENT) {
> > +			tpm_chip_unregister(chip);
> > +			return rc;
> > +		}
> > +	}
> > +
> >  	return 0;
> >  out_err:
> >  	tpm1_chip_unregister(chip);
> > -- 
> > 2.5.0
> > 
> 
> This patch doesn't apply to the latest linux-next (20151109).  I think I
> may be missing a dependent patch.  Do you know which one?

It is expected as there are 7 other bug fixes that I'm including to the
next pull rquest and this is on top.

> - Jeremiah Mahler

/Jarkko

      reply	other threads:[~2015-11-10  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-08  7:51 [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register() Jarkko Sakkinen
2015-11-09 22:47 ` Jason Gunthorpe
2015-11-10  4:02   ` Jarkko Sakkinen
2015-11-10  6:11 ` Jeremiah Mahler
2015-11-10  6:16   ` Jarkko Sakkinen [this message]

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=20151110061616.GA4404@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=jmmahler@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.