On Wed, Nov 16, 2016 at 01:38:53PM -0700, Jason Gunthorpe wrote:
> On Wed, Nov 16, 2016 at 08:56:13AM -0500, Stefan Berger wrote:
> > Check the bios_dir entry for NULL before accessing it. Currently
> > this crashes the driver when a TPM 2 is attached and the entries
> > are NULL.
> 
> Yep
> 
> >     for (i = (TPM_NUM_EVENT_LOG_FILES - 1); i >= 0; i--) {
> > -           inode = d_inode(chip->bios_dir[i]);
> > -           inode_lock(inode);
> > -           inode->i_private = NULL;
> > -           inode_unlock(inode);
> > -           securityfs_remove(chip->bios_dir[i]);
> > +           if (chip->bios_dir[i]) {
> 
> Nope, this must be is_err_or_null, we store err ptrs in this array.

"
err:
        chip->bios_dir[cnt] = NULL;
"

There is assignment to NULL so this should be fine.

/JArko

------------------------------------------------------------------------------
_______________________________________________
tpmdd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

Reply via email to