Skip to content

Commit

Permalink
Fix memory leak in tpm_binary_bios_measurements_open()
Browse files Browse the repository at this point in the history
The same problem that was fixed for tpm_ascii_bios_measurements_open()
in commit 178554a also occurs in
tpm_binary_bios measurements().  Thanks for noticing this Satyam!

I tested the attached patch to fix tpm_binary_bios_measurments as well.

Signed-off-by: Reiner Sailer <sailer@watson.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Reiner Sailer authored and Linus Torvalds committed Jul 20, 2007
1 parent c1158e6 commit 03ce110
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/char/tpm/tpm_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,18 +465,23 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
return -ENOMEM;

if ((err = read_log(log)))
return err;
goto out_free;

/* now register seq file */
err = seq_open(file, &tpm_binary_b_measurments_seqops);
if (!err) {
seq = file->private_data;
seq->private = log;
} else {
kfree(log->bios_event_log);
kfree(log);
goto out_free;
}

out:
return err;
out_free:
kfree(log->bios_event_log);
kfree(log);
goto out;
}

const struct file_operations tpm_binary_bios_measurements_ops = {
Expand Down

0 comments on commit 03ce110

Please sign in to comment.