mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-04-29 12:28:27 +02:00
char: tpm: Fix possible memory leak in tpm_bios_measurements_open()
commit5d8e2971e8upstream. In tpm_bios_measurements_open(), get_device() is called on the device embedded in struct tpm_chip. In the error path, however, put_device() is not called. This results in a reference count leak, which prevents the device from being properly released. This commit makes sure to call put_device() when the seq_open() call fails. Cc: stable@vger.kernel.org # +v4.18 Fixes:9b01b53566("tpm: Move shared eventlog functions to common.c") Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
215e9a695e
commit
558e339b16
@@ -47,6 +47,8 @@ static int tpm_bios_measurements_open(struct inode *inode,
|
||||
if (!err) {
|
||||
seq = file->private_data;
|
||||
seq->private = chip;
|
||||
} else {
|
||||
put_device(&chip->dev);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user