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]
Message-ID: <20120815201527.GC27618@linux.vnet.ibm.com>
Date:	Wed, 15 Aug 2012 15:15:27 -0500
From:	Kent Yoder <key@...ux.vnet.ibm.com>
To:	Jesper Juhl <jj@...osbits.net>
Cc:	linux-kernel@...r.kernel.org, tpmdd-devel@...ts.sourceforge.net,
	Sirrix AG <tpmdd@...rix.com>,
	Marcel Selhorst <tpmdd@...horst.net>,
	Rajiv Andrade <mail@...jiv.net>,
	Seiji Munetoh <munetoh@...ibm.com>,
	Stefan Berger <stefanb@...ibm.com>,
	Reiner Sailer <sailer@...son.ibm.com>,
	Kylene Hall <kjhall@...ibm.com>
Subject: Re: [PATCH] tpm: Do not dereference NULL pointer if
 acpi_os_map_memory() fails.

Hi Jesper,

> > Unfortunately we just get NULL back, so we can't really tell the user
> > exactely what went wrong, but we can at least avoid crashing and
> > return an error (-EIO seemed more generic and more suitable here than
> > -ENOMEM or something else, so I picked that).
> 
> Thanks Jesper. I'd made some updates to tpm_bios.c recently but this
> should still apply. I'll let you know if not.

  Of course I'm wrong here, this code moved over into tpm_acpi.c. If you
can resubmit on top of my staging tree, I will apply it there.

git://github.com/shpedoikal/linux.git v3.6-rc1-tpmdd-staging

> > Signed-off-by: Jesper Juhl <jj@...osbits.net>
> > ---
> >  drivers/char/tpm/tpm_bios.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> >   Compile tested only.
> > 
> > diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
> > index 0636520..0c5c274 100644
> > --- a/drivers/char/tpm/tpm_bios.c
> > +++ b/drivers/char/tpm/tpm_bios.c
> > @@ -410,6 +410,11 @@ static int read_log(struct tpm_bios_log *log)
> >  	log->bios_event_log_end = log->bios_event_log + len;
> > 
> >  	virt = acpi_os_map_memory(start, len);
> > +	if (!virt) {

  Also please add kfree(log->bios_event_log); in this error path.

Thanks,
Kent

> > +		printk("%s: ERROR - Unable to map memory\n",
> > +			__func__);
> > +		return -EIO;
> > +	}
> > 
> >  	memcpy(log->bios_event_log, virt, len);
> > 
> > -- 
> > 1.7.11.4
> > 
> > 
> > -- 
> > Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
> > Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> > Plain text mails only, please.
> > 
> 
> --
> 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/
> 

--
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