Re: [tpmdd-devel] [PATCH 2/2] tpm: replace dynamically allocated bios_dir with a static array

2016-10-01 Thread Jarkko Sakkinen
On Sat, Oct 01, 2016 at 10:49:32AM -0600, Jason Gunthorpe wrote: > On Sat, Oct 01, 2016 at 03:41:17PM +0300, Jarkko Sakkinen wrote: > > - bin_file = > > + chip->bios_dir[cnt] = > > securityfs_create_file("binary_bios_measurements", > > - S_IRUSR | S_IRGRP,

[tpmdd-devel] [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array

2016-10-01 Thread Jarkko Sakkinen
This commit is based on a commit by Nayna Jain. Replaced dynamically allocated bios_dir with a static array as the size is always constant. Suggested-by: Jason Gunthorpe Signed-off-by: Nayna Jain Signed-off-by: Jarkko Sakkinen

[tpmdd-devel] [PATCH RESEND 1/3] tpm: define a generic open() method for ascii & bios measurements

2016-10-01 Thread Jarkko Sakkinen
From: Nayna Jain open() method for event log ascii and binary bios measurements file operations are very similar. This patch refactors the code into a single open() call by passing seq_operations as i_node->private data. Suggested-by: Jason Gunthorpe

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jarkko Sakkinen
On Sat, Oct 01, 2016 at 10:54:36AM -0600, Jason Gunthorpe wrote: > On Sat, Oct 01, 2016 at 03:01:25PM +0300, Jarkko Sakkinen wrote: > > > > + struct tpm_securityfs_data bin_sfs_data; > > > + struct tpm_securityfs_data ascii_sfs_data; > > > > I think this is otherwise right but the struct name is

Re: [tpmdd-devel] [PATCH v4 2/8] tpm: replace dynamically allocated bios_dir with dentry array

2016-10-01 Thread Jarkko Sakkinen
On Wed, Sep 28, 2016 at 04:34:36AM -0400, Nayna Jain wrote: > bios_dir is defined as struct dentry **bios_dir, which results in > dynamic allocation and therefore possibly a memory leak. This patch > replaces it with struct dentry array(struct dentry *bios_dir[3]) > similar to what is done for

Re: [tpmdd-devel] [PATCH v4 8/8] tpm: add securityfs support for TPM 2.0 firmware event log

2016-10-01 Thread Jarkko Sakkinen
On Wed, Sep 28, 2016 at 04:34:42AM -0400, Nayna Jain wrote: > Unlike the device driver support for TPM 1.2, the TPM 2.0 support > does not create the securityfs pseudo files for displaying the > firmware event log. > > This patch enables support for providing the TPM 2.0 event log in > binary

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jarkko Sakkinen
On Fri, Sep 30, 2016 at 08:42:13PM -0600, Jason Gunthorpe wrote: > On Fri, Sep 30, 2016 at 10:45:38PM +0300, Jarkko Sakkinen wrote: > > > Ok, this is interesting. What kind of refcounting bugs are related > > to existing approach? > > IIRC it was because the log was being processed in an fops

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jarkko Sakkinen
On Wed, Sep 28, 2016 at 04:34:37AM -0400, Nayna Jain wrote: > Currently, the securityfs pseudo files for obtaining the firmware > event log are created whether the event log properties exist or not. > This patch creates ascii and bios measurements pseudo files > only if read_log() is successful.

[tpmdd-devel] [PATCH 2/2] tpm: replace dynamically allocated bios_dir with a static array

2016-10-01 Thread Jarkko Sakkinen
This commit is based on a commit by Nayna Jain. Replaced dynamically allocated bios_dir with a static array as the size is always constant. Suggested-by: Jason Gunthorpe Signed-off-by: Nayna Jain Signed-off-by: Jarkko Sakkinen

[tpmdd-devel] [PATCH 1/2] tpm: define a generic open() method for ascii & bios measurements

2016-10-01 Thread Jarkko Sakkinen
From: Nayna Jain open() method for event log ascii and binary bios measurements file operations are very similar. This patch refactors the code into a single open() call by passing seq_operations as i_node->private data. Suggested-by: Jason Gunthorpe

[tpmdd-devel] [PATCH 0/2] Clean up handling of event log files

2016-10-01 Thread Jarkko Sakkinen
Meld a common function for opening measurements files and keep the dentries in a static array. Jarkko Sakkinen (1): tpm: replace dynamically allocated bios_dir with a static array Nayna Jain (1): tpm: define a generic open() method for ascii & bios measurements drivers/char/tpm/tpm-chip.c

Re: [tpmdd-devel] [PATCH v4 2/8] tpm: replace dynamically allocated bios_dir with dentry array

2016-10-01 Thread Jarkko Sakkinen
On Fri, Sep 30, 2016 at 02:31:47PM -0600, Jason Gunthorpe wrote: > On Fri, Sep 30, 2016 at 10:48:25PM +0300, Jarkko Sakkinen wrote: > > On Fri, Sep 30, 2016 at 12:30:26PM -0600, Jason Gunthorpe wrote: > > > On Fri, Sep 30, 2016 at 09:27:03PM +0300, Jarkko Sakkinen wrote: > > > > On Wed, Sep 28,

Re: [tpmdd-devel] [PATCH 0/2] Clean up handling of event log files

2016-10-01 Thread Jarkko Sakkinen
Please ignore this version. I was going to do a '--dry-run'. Sorry :( Doing resend later on once I've tested the changes. /Jarkko On Sat, Oct 01, 2016 at 03:41:15PM +0300, Jarkko Sakkinen wrote: > Meld a common function for opening measurements files and keep the > dentries in a static array. >

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jarkko Sakkinen
On Sat, Oct 01, 2016 at 03:01:25PM +0300, Jarkko Sakkinen wrote: > On Wed, Sep 28, 2016 at 04:34:37AM -0400, Nayna Jain wrote: > > Currently, the securityfs pseudo files for obtaining the firmware > > event log are created whether the event log properties exist or not. > > This patch creates ascii

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jason Gunthorpe
On Sat, Oct 01, 2016 at 03:01:25PM +0300, Jarkko Sakkinen wrote: > > + struct tpm_securityfs_data bin_sfs_data; > > + struct tpm_securityfs_data ascii_sfs_data; > > I think this is otherwise right but the struct name is very clunky. > First of all it doesn't own the data and IMHO now it kind

Re: [tpmdd-devel] [PATCH v4 3/8] tpm: validate event log access before tpm_bios_log_setup

2016-10-01 Thread Jarkko Sakkinen
On Sat, Oct 01, 2016 at 10:32:39PM +0300, Jarkko Sakkinen wrote: > On Sat, Oct 01, 2016 at 10:54:36AM -0600, Jason Gunthorpe wrote: > > On Sat, Oct 01, 2016 at 03:01:25PM +0300, Jarkko Sakkinen wrote: > > > > > > + struct tpmfs_data bin_sfs_data; > > > > + struct tpmfs_data