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] [day] [month] [year] [list]
Message-ID: <20161011181211.GB6900@intel.com>
Date:   Tue, 11 Oct 2016 21:12:11 +0300
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Nayna <nayna@...ux.vnet.ibm.com>
Cc:     Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
        Peter Huewe <peterhuewe@....de>,
        Marcel Selhorst <tpmdd@...horst.net>,
        "moderated list:TPM DEVICE DRIVER" 
        <tpmdd-devel@...ts.sourceforge.net>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir
 with a static array

On Tue, Oct 11, 2016 at 10:49:56PM +0530, Nayna wrote:
> 
> 
> On 10/11/2016 10:23 PM, Jason Gunthorpe wrote:
> >On Tue, Oct 11, 2016 at 02:23:15PM +0300, Jarkko Sakkinen wrote:
> >>>>+	chip->bios_dir[cnt] =
> >>>>  	    securityfs_create_file("ascii_bios_measurements",
> >>>>-				   S_IRUSR | S_IRGRP, tpm_dir,
> >>>>+				   S_IRUSR | S_IRGRP, chip->bios_dir[0],
> >>>>  				   (void *)&tpm_ascii_b_measurments_seqops,
> >>>>  				   &tpm_bios_measurements_ops);
> >
> >>>>+	if (is_bad(chip->bios_dir[cnt]))
> >>>>+		goto err;
> >
> >>>>+err:
> >>>>+	chip->bios_dir[cnt] = NULL;
> >>>
> >>>The updated patch looks fine.
> >>>Just, I am not sure if NULL assignment is needed.
> >>
> >>It's not needed.
> >
> >It is required to switch an ERR_PTR to NULL, see is_bad()
> 
> My understanding is that securityfs_remove() takes care of both NULL and
> ERR_PTR().
> 
> From securityfs_remove():
> 
>  if (!dentry || IS_ERR(dentry))
>                 return;

Right. I just checked from LXR. Seems weird that they have that kind of
special handling for IS_ERR. Checking for NULL is more usual.  I think I
keep setting NULL anyway if nothing else for robustness.  Anyway, thanks
for pointing this out.

> Thanks & Regards,
>   - Nayna

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ