TPM: Avoid reference to potentially freed memory
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 22 Oct 2015 20:32:41 +0000 (22:32 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 9 Nov 2015 15:52:55 +0000 (17:52 +0200)
commiteb8ed1eb9a158c460d10205eaff71fd4ac67c160
treec42ea86d67926552c79f43e17f6ec831fb8bf8b4
parent14b5c1c9159bf6f109b667d31da82859d8c8cdcd
TPM: Avoid reference to potentially freed memory

Reference to the 'np' node is dropped before dereferencing the 'sizep' and
'basep' pointers, which could by then point to junk if the node has been
freed.

Refactor code to call 'of_node_put' later.

Fixes: c5df39262dd5 ("drivers/char/tpm: Add securityfs support for event log")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Acked-by: Peter Huewe <PeterHuewe@gmx.de>
drivers/char/tpm/tpm_of.c