aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorReiner Sailer <sailer@us.ibm.com>2007-07-20 10:03:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 15:00:04 -0400
commit03ce11048b3832f5f0c471ccdb3363a870a14ac1 (patch)
tree6f12eb6f9a11046474585fed67a05eb6c76ed248 /drivers/char/tpm
parentc1158e63dfeb3928e94c768f0a403b3e0e799f70 (diff)
Fix memory leak in tpm_binary_bios_measurements_open()
The same problem that was fixed for tpm_ascii_bios_measurements_open() in commit 178554ae75739e91dc4d7c3e42a3db95448cc5bf 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>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm_bios.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 4b26ce48189b..8677fc6a545e 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -465,7 +465,7 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
465 return -ENOMEM; 465 return -ENOMEM;
466 466
467 if ((err = read_log(log))) 467 if ((err = read_log(log)))
468 return err; 468 goto out_free;
469 469
470 /* now register seq file */ 470 /* now register seq file */
471 err = seq_open(file, &tpm_binary_b_measurments_seqops); 471 err = seq_open(file, &tpm_binary_b_measurments_seqops);
@@ -473,10 +473,15 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
473 seq = file->private_data; 473 seq = file->private_data;
474 seq->private = log; 474 seq->private = log;
475 } else { 475 } else {
476 kfree(log->bios_event_log); 476 goto out_free;
477 kfree(log);
478 } 477 }
478
479out:
479 return err; 480 return err;
481out_free:
482 kfree(log->bios_event_log);
483 kfree(log);
484 goto out;
480} 485}
481 486
482const struct file_operations tpm_binary_bios_measurements_ops = { 487const struct file_operations tpm_binary_bios_measurements_ops = {