]> git.ipfire.org Git - people/ms/linux.git/commit
tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma
authorHon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com>
Sun, 30 Nov 2014 14:01:28 +0000 (15:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:52:57 +0000 (14:52 -0800)
commit2a7a2065baa0a0d72d77d7875bef78761d2e704c
tree7736973d6fdfe529647f8e3bfbb35e2f9316c61e
parent73da0742175da3f7b2416771037612cdc1ea52f4
tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma

commit 84eb186bc37c0900b53077ca21cf6dd15823a232 upstream.

There was an oops in tpm_ibmvtpm_get_desired_dma, which caused
kernel panic during boot when vTPM is enabled in Power partition
configured in AMS mode.

vio_bus_probe calls vio_cmo_bus_probe which calls
tpm_ibmvtpm_get_desired_dma to get the size needed for DMA allocation.
The problem is, vio_cmo_bus_probe is called before calling probe, which
for vtpm is tpm_ibmvtpm_probe and it's this function that initializes
and sets up vtpm's CRQ and gets required data values.  Therefore,
since this has not yet been done, NULL is returned in attempt to get
the size for DMA allocation.

We added a NULL check.  In addition, a default buffer size will
be set when NULL is returned.

Signed-off-by: Hon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm_ibmvtpm.c