lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Sep 2014 22:28:38 +0300
From:	Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:	Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc:	tpmdd-devel@...ts.sourceforge.net, Peter Huewe <peterhuewe@....de>,
	Marcel Selhorst <tpmdd@...horst.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 11/12] tpm: Driver for TPM 2.0 CRB Interface

Thanks for reviewing this. I'll fix these issues, not much to add.
Thank you.

/Jarkko

On Wed, Sep 24, 2014 at 11:05:51AM -0600, Jason Gunthorpe wrote:
> On Wed, Sep 24, 2014 at 12:06:01PM +0300, Jarkko Sakkinen wrote:
> 
> > +	offset = cca->rsp_pa - priv->cca_pa;
> > +	resp = (u8 *) ((unsigned long) cca + offset);
> > +	memcpy(buf, resp, 6);
> > +	expected = be32_to_cpu(*(__be32 *) (buf + 2));
> 
> be32_to_cpup?
> 
> > +static void crb_release(void *data)
> > +{
> > +	struct tpm_chip *chip = (struct tpm_chip *) data;
> > +	tpm_remove_hardware(chip->dev);
> > +}
> 
> Please use a proper remove function on the device driver, not a devm
> function like this. 'tpm_remove_hardware' is the wrong name for a new
> API, it must be 'tpm_chip_unregister' (ie the undo of 'tpm_chip_register')
> 
> > +static int crb_acpi_add(struct acpi_device *device)
> > +{
> > +	struct tpm_chip *chip;
> > +	struct acpi_tpm2 *buf;
> > +	struct crb_priv *priv;
> > +	struct device *dev = &device->dev;
> > +	acpi_status status;
> > +	u32 sm;
> > +	int rc;
> > +
> > +	chip = tpm_chip_alloc(dev, &tpm_crb);
> > +	if (!chip)
> > +		return -ENODEV;
> 
> Lets use ERRPTR here
> 
> > +	chip->tpm2 = true;
> > +
> > +	rc = tpm_chip_register(chip);
> 
> This is in the wrong place, it needs to be the last call in the probe
> function - the driver must be fully operational when register is
> called, that is one of the bugs the new interface must be fixing.
> 
> > +	rc = tpm_do_selftest(chip);
> > +	if (rc) {
> > +		rc = -ENODEV;
> > +		goto out_err;
> > +	}
> 
> The common TPM command startup sequence should be in
> tpm_chip_register(), so move this into there.
> 
> > +	rc = devm_add_action(dev, crb_release, chip);
> > +	if (rc)
> > +		goto out_err;
> > +
> > +	return 0;
> > +out_err:
> > +	tpm_remove_hardware(chip->dev);
> > +	return rc;
> > +}
> > +
> > +static struct acpi_device_id crb_device_ids[] = {
> 
> const? Not sure
> 
> Jason
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ