diff mbox

vTPM: set virtual device before passing to ibmvtpm_reset_crq

Message ID 1432315382-11711-1-git-send-email-honclo@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hon Ching (Vicky) Lo May 22, 2015, 5:23 p.m. UTC
tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet
set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq,
the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Ashley Lai June 2, 2015, 5:50 a.m. UTC | #1
Thanks for the patch.  Looks good to me.

Reviewed-by: Ashley Lai <ashley@ahsleylai.com>

--Ashley Lai

On Fri, 22 May 2015, Hon Ching(Vicky) Lo wrote:

> tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet
> set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq,
> the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.
>
> Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
> ---
> drivers/char/tpm/tpm_ibmvtpm.c |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
> index 42ffa5e..27ebf95 100644
> --- a/drivers/char/tpm/tpm_ibmvtpm.c
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -578,6 +578,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
> 		goto cleanup;
> 	}
>
> +	ibmvtpm->dev = dev;
> +	ibmvtpm->vdev = vio_dev;
> +
> 	crq_q = &ibmvtpm->crq_queue;
> 	crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
> 	if (!crq_q->crq_addr) {
> @@ -622,8 +625,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
>
> 	crq_q->index = 0;
>
> -	ibmvtpm->dev = dev;
> -	ibmvtpm->vdev = vio_dev;
> 	TPM_VPRIV(chip) = (void *)ibmvtpm;
>
> 	spin_lock_init(&ibmvtpm->rtce_lock);
> -- 
> 1.7.1
>
>

------------------------------------------------------------------------------
Peter Huewe June 16, 2015, 8:37 p.m. UTC | #2
Hey,

Am Freitag, 22. Mai 2015, 19:23:02 schrieb Hon Ching(Vicky) Lo:
> tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet
> set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq,
> the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.
> 
> Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
> ---
>  drivers/char/tpm/tpm_ibmvtpm.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c
> b/drivers/char/tpm/tpm_ibmvtpm.c index 42ffa5e..27ebf95 100644
> --- a/drivers/char/tpm/tpm_ibmvtpm.c
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -578,6 +578,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
>  		goto cleanup;
>  	}
> 
> +	ibmvtpm->dev = dev;
> +	ibmvtpm->vdev = vio_dev;
> +
>  	crq_q = &ibmvtpm->crq_queue;
>  	crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
>  	if (!crq_q->crq_addr) {
> @@ -622,8 +625,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
> 
>  	crq_q->index = 0;
> 
> -	ibmvtpm->dev = dev;
> -	ibmvtpm->vdev = vio_dev;
>  	TPM_VPRIV(chip) = (void *)ibmvtpm;
> 
>  	spin_lock_init(&ibmvtpm->rtce_lock);

Is this a fix for something?
does it need to go through stable?

Thanks,
Peter

------------------------------------------------------------------------------
Hon Ching (Vicky) Lo June 16, 2015, 9:18 p.m. UTC | #3
Hi Peter,

Yes, it's a fix to a kernel dump caused by enabling both vtpm and kdump.


On Tue, 2015-06-16 at 22:37 +0200, Peter Hüwe wrote:
> Hey,
> 
> Am Freitag, 22. Mai 2015, 19:23:02 schrieb Hon Ching(Vicky) Lo:
> > tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet
> > set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq,
> > the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.
> > 
> > Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> > Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
> > ---
> >  drivers/char/tpm/tpm_ibmvtpm.c |    5 +++--
> >  1 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm_ibmvtpm.c
> > b/drivers/char/tpm/tpm_ibmvtpm.c index 42ffa5e..27ebf95 100644
> > --- a/drivers/char/tpm/tpm_ibmvtpm.c
> > +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> > @@ -578,6 +578,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
> >  		goto cleanup;
> >  	}
> > 
> > +	ibmvtpm->dev = dev;
> > +	ibmvtpm->vdev = vio_dev;
> > +
> >  	crq_q = &ibmvtpm->crq_queue;
> >  	crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
> >  	if (!crq_q->crq_addr) {
> > @@ -622,8 +625,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
> > 
> >  	crq_q->index = 0;
> > 
> > -	ibmvtpm->dev = dev;
> > -	ibmvtpm->vdev = vio_dev;
> >  	TPM_VPRIV(chip) = (void *)ibmvtpm;
> > 
> >  	spin_lock_init(&ibmvtpm->rtce_lock);
> 
> Is this a fix for something?
> does it need to go through stable?
> 
> Thanks,
> Peter
> 



------------------------------------------------------------------------------
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 42ffa5e..27ebf95 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -578,6 +578,9 @@  static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
 		goto cleanup;
 	}
 
+	ibmvtpm->dev = dev;
+	ibmvtpm->vdev = vio_dev;
+
 	crq_q = &ibmvtpm->crq_queue;
 	crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
 	if (!crq_q->crq_addr) {
@@ -622,8 +625,6 @@  static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
 
 	crq_q->index = 0;
 
-	ibmvtpm->dev = dev;
-	ibmvtpm->vdev = vio_dev;
 	TPM_VPRIV(chip) = (void *)ibmvtpm;
 
 	spin_lock_init(&ibmvtpm->rtce_lock);