mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ashley Lai <ashley@ashleylai.com>
To: Anton Blanchard <anton@samba.org>
Cc: Peter Huewe <peterhuewe@gmx.de>,
	Ashley Lai <ashley@ashleylai.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
Date: Mon, 22 Sep 2014 12:45:38 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1409221243390.4510@ant> (raw)
In-Reply-To: <20140920072942.27c28768@kryten>



On Sat, 20 Sep 2014, Anton Blanchard wrote:

> I'm looking at an oops in tpm_ibmvtpm_get_desired_dma:
>
>  28:	00 00 20 39 	li      r9,0
>  2c:	10 00 01 e8 	ld      r0,16(r1)
>  30:	28 00 69 80 	lwz     r3,40(r9)
>
> We set r9 to 0 then load r9+40. The problem is actually in
> ibmvtpm_get_data, it can return NULL but the rest of the driver
> never expects it.
>
> Add a BUG_ON in ibmvtpm_get_data. We still need to identify the root
> cause but at least this makes it obvious what went wrong.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
> index af74c57..0d1eeba 100644
> --- a/drivers/char/tpm/tpm_ibmvtpm.c
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -63,9 +63,9 @@ static int ibmvtpm_send_crq(struct vio_dev *vdev, u64 w1, u64 w2)
> static struct ibmvtpm_dev *ibmvtpm_get_data(const struct device *dev)
> {
> 	struct tpm_chip *chip = dev_get_drvdata(dev);
> -	if (chip)
> -		return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> -	return NULL;
> +
> +	BUG_ON(!chip);
> +	return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> }
>
> /**
>

Acked-by: Ashley Lai <ashley@ashleylai.com>


  parent reply	other threads:[~2014-09-22 17:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19 21:29 Anton Blanchard
2014-09-19 21:30 ` [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts Anton Blanchard
2014-09-22 17:49   ` Ashley Lai
2014-09-24 16:18   ` [tpmdd-devel] " Jason Gunthorpe
2014-09-22 17:43 ` [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Ashley Lai
2014-09-22 18:03   ` [tpmdd-devel] " Jason Gunthorpe
2014-09-22 17:45 ` Ashley Lai [this message]
2014-12-02 19:22 ` Ashley Lai
2014-12-02 19:46   ` Peter Hüwe
2014-12-02 20:09     ` Ashley Lai
2014-12-02 20:39 ` Peter Hüwe
2014-12-02 21:20   ` Anton Blanchard
2014-12-03 23:11     ` Hon Ching (Vicky) Lo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1409221243390.4510@ant \
    --to=ashley@ashleylai.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®