lkml.org 
[lkml]   [2012]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.
On Wed, 15 Aug 2012, Kent Yoder wrote:

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

No problem. I'll have that patch for you in a moment when I'm done
fetching your tree.


> git://github.com/shpedoikal/linux.git v3.6-rc1-tpmdd-staging
>
> > > Signed-off-by: Jesper Juhl <jj@chaosbits.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.
>
Whoops, of course, will do.


--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.



\
 
 \ /
  Last update: 2012-08-16 00:43    [W:0.084 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site