Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03ce1104 authored by Reiner Sailer's avatar Reiner Sailer Committed by Linus Torvalds
Browse files

Fix memory leak in tpm_binary_bios_measurements_open()



The same problem that was fixed for tpm_ascii_bios_measurements_open()
in commit 178554ae 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: default avatarReiner Sailer <sailer@watson.ibm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c1158e63
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ 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);
@@ -473,10 +473,15 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
		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 = {