* [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
@ 2014-09-19 21:29 Anton Blanchard
2014-09-19 21:30 ` [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts Anton Blanchard
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Anton Blanchard @ 2014-09-19 21:29 UTC (permalink / raw)
To: Peter Huewe, Ashley Lai, Marcel Selhorst; +Cc: tpmdd-devel, linux-kernel
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);
}
/**
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Anton Blanchard
@ 2014-09-19 21:30 ` 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
` (3 subsequent siblings)
4 siblings, 2 replies; 13+ messages in thread
From: Anton Blanchard @ 2014-09-19 21:30 UTC (permalink / raw)
To: Peter Huewe, Ashley Lai, Marcel Selhorst; +Cc: tpmdd-devel, linux-kernel
There is no need to cast from a void pointer to another pointer.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: b/drivers/char/tpm/tpm_ibmvtpm.c
===================================================================
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -65,7 +65,7 @@ static struct ibmvtpm_dev *ibmvtpm_get_d
struct tpm_chip *chip = dev_get_drvdata(dev);
BUG_ON(!chip);
- return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
+ return TPM_VPRIV(chip);
}
/**
@@ -83,7 +83,7 @@ static int tpm_ibmvtpm_recv(struct tpm_c
u16 len;
int sig;
- ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip);
+ ibmvtpm = TPM_VPRIV(chip);
if (!ibmvtpm->rtce_buf) {
dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
@@ -127,7 +127,7 @@ static int tpm_ibmvtpm_send(struct tpm_c
u64 *word = (u64 *) &crq;
int rc;
- ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip);
+ ibmvtpm = TPM_VPRIV(chip);
if (!ibmvtpm->rtce_buf) {
dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
@@ -521,7 +521,7 @@ static void ibmvtpm_crq_process(struct i
**/
static irqreturn_t ibmvtpm_interrupt(int irq, void *vtpm_instance)
{
- struct ibmvtpm_dev *ibmvtpm = (struct ibmvtpm_dev *) vtpm_instance;
+ struct ibmvtpm_dev *ibmvtpm = vtpm_instance;
struct ibmvtpm_crq *crq;
/* while loop is needed for initial setup (get version and
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Anton Blanchard
2014-09-19 21:30 ` [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts Anton Blanchard
@ 2014-09-22 17:43 ` Ashley Lai
2014-09-22 18:03 ` [tpmdd-devel] " Jason Gunthorpe
2014-09-22 17:45 ` Ashley Lai
` (2 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Ashley Lai @ 2014-09-22 17:43 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Huewe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
Hi Anton,
Thanks for the patch. Is this oops easy to recreate? If so could
you give us the steps to reproduce?
Thanks,
--Ashley Lai
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);
> }
>
> /**
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Anton Blanchard
2014-09-19 21:30 ` [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts Anton Blanchard
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 17:45 ` Ashley Lai
2014-12-02 19:22 ` Ashley Lai
2014-12-02 20:39 ` Peter Hüwe
4 siblings, 0 replies; 13+ messages in thread
From: Ashley Lai @ 2014-09-22 17:45 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Huewe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
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>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts
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
1 sibling, 0 replies; 13+ messages in thread
From: Ashley Lai @ 2014-09-22 17:49 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Huewe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
On Sat, 20 Sep 2014, Anton Blanchard wrote:
> There is no need to cast from a void pointer to another pointer.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Ashley Lai <ashley@ashleylai.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [tpmdd-devel] [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
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 ` Jason Gunthorpe
0 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2014-09-22 18:03 UTC (permalink / raw)
To: Ashley Lai; +Cc: Anton Blanchard, tpmdd-devel, linux-kernel
On Mon, Sep 22, 2014 at 12:43:27PM -0500, Ashley Lai wrote:
> Hi Anton,
>
> Thanks for the patch. Is this oops easy to recreate? If so could
> you give us the steps to reproduce?
This looks like it is probably related to the uninitialization mess in
the TPM core (resource held during module unload?). A driver should
not have to defend itself against null drvdata, so the BUG makes
more sense than the if it is replacing.
Jason
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [tpmdd-devel] [PATCH 2/2] tpm/tpm_ibmvtpm: Remove unnecessary casts
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 ` Jason Gunthorpe
1 sibling, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2014-09-24 16:18 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Huewe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
On Sat, Sep 20, 2014 at 07:30:14AM +1000, Anton Blanchard wrote:
> There is no need to cast from a void pointer to another pointer.
Looks reasonable to me:
Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Anton Blanchard <anton@samba.org>
>
> Index: b/drivers/char/tpm/tpm_ibmvtpm.c
> ===================================================================
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -65,7 +65,7 @@ static struct ibmvtpm_dev *ibmvtpm_get_d
> struct tpm_chip *chip = dev_get_drvdata(dev);
>
> BUG_ON(!chip);
> - return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> + return TPM_VPRIV(chip);
> }
>
> /**
> @@ -83,7 +83,7 @@ static int tpm_ibmvtpm_recv(struct tpm_c
> u16 len;
> int sig;
>
> - ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> + ibmvtpm = TPM_VPRIV(chip);
>
> if (!ibmvtpm->rtce_buf) {
> dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
> @@ -127,7 +127,7 @@ static int tpm_ibmvtpm_send(struct tpm_c
> u64 *word = (u64 *) &crq;
> int rc;
>
> - ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> + ibmvtpm = TPM_VPRIV(chip);
>
> if (!ibmvtpm->rtce_buf) {
> dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
> @@ -521,7 +521,7 @@ static void ibmvtpm_crq_process(struct i
> **/
> static irqreturn_t ibmvtpm_interrupt(int irq, void *vtpm_instance)
> {
> - struct ibmvtpm_dev *ibmvtpm = (struct ibmvtpm_dev *) vtpm_instance;
> + struct ibmvtpm_dev *ibmvtpm = vtpm_instance;
> struct ibmvtpm_crq *crq;
>
> /* while loop is needed for initial setup (get version and
>
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> tpmdd-devel mailing list
> tpmdd-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
--
Jason Gunthorpe <jgunthorpe@obsidianresearch.com> (780)4406067x832
Chief Technology Officer, Obsidian Research Corp Edmonton, Canada
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Anton Blanchard
` (2 preceding siblings ...)
2014-09-22 17:45 ` Ashley Lai
@ 2014-12-02 19:22 ` Ashley Lai
2014-12-02 19:46 ` Peter Hüwe
2014-12-02 20:39 ` Peter Hüwe
4 siblings, 1 reply; 13+ messages in thread
From: Ashley Lai @ 2014-12-02 19:22 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Huewe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
> @@ -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);
With the recent patch from Vicky, it is possible to have a NULL value for
chip which will trigger a false positive for BUG_ON(!chip).
> + return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> }
>
> /**
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-12-02 19:22 ` Ashley Lai
@ 2014-12-02 19:46 ` Peter Hüwe
2014-12-02 20:09 ` Ashley Lai
0 siblings, 1 reply; 13+ messages in thread
From: Peter Hüwe @ 2014-12-02 19:46 UTC (permalink / raw)
To: Ashley Lai; +Cc: Anton Blanchard, Marcel Selhorst, tpmdd-devel, linux-kernel
Hi,
so shall I apply this patch? or not?
Thanks,
Peter
Am Dienstag, 2. Dezember 2014, 20:22:35 schrieb Ashley Lai:
> > @@ -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);
>
> With the recent patch from Vicky, it is possible to have a NULL value for
> chip which will trigger a false positive for BUG_ON(!chip).
>
> > + return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
> > }
> >
> > /**
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-12-02 19:46 ` Peter Hüwe
@ 2014-12-02 20:09 ` Ashley Lai
0 siblings, 0 replies; 13+ messages in thread
From: Ashley Lai @ 2014-12-02 20:09 UTC (permalink / raw)
To: Peter Hüwe
Cc: Ashley Lai, Anton Blanchard, Marcel Selhorst, tpmdd-devel,
linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 815 bytes --]
I recommend not applying this patch until we hear back from IBM.
Thanks,
--Ashley
On Tue, 2 Dec 2014, Peter Hüwe wrote:
> Hi,
>
> so shall I apply this patch? or not?
>
> Thanks,
> Peter
>
> Am Dienstag, 2. Dezember 2014, 20:22:35 schrieb Ashley Lai:
>>> @@ -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);
>>
>> With the recent patch from Vicky, it is possible to have a NULL value for
>> chip which will trigger a false positive for BUG_ON(!chip).
>>
>>> + return (struct ibmvtpm_dev *)TPM_VPRIV(chip);
>>> }
>>>
>>> /**
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad Anton Blanchard
` (3 preceding siblings ...)
2014-12-02 19:22 ` Ashley Lai
@ 2014-12-02 20:39 ` Peter Hüwe
2014-12-02 21:20 ` Anton Blanchard
4 siblings, 1 reply; 13+ messages in thread
From: Peter Hüwe @ 2014-12-02 20:39 UTC (permalink / raw)
To: Anton Blanchard, Hon Ching (Vicky) Lo
Cc: Ashley Lai, Marcel Selhorst, tpmdd-devel, linux-kernel
Hi Anton,
is this patchset still needed after Vicky's patch
"[tpmdd-devel] Fix NULL return in tpm_ibmvtpm_get_desired_dma"
https://patchwork.ozlabs.org/patch/402315/
Ashley raised some concerns.
Since merge window is coming up, a fast reply is appreciated.
Thanks,
Peter
Am Freitag, 19. September 2014, 23:29:42 schrieb Anton Blanchard:
> 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);
> }
>
> /**
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-12-02 20:39 ` Peter Hüwe
@ 2014-12-02 21:20 ` Anton Blanchard
2014-12-03 23:11 ` Hon Ching (Vicky) Lo
0 siblings, 1 reply; 13+ messages in thread
From: Anton Blanchard @ 2014-12-02 21:20 UTC (permalink / raw)
To: Peter Hüwe
Cc: Hon Ching (Vicky) Lo, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
Hi,
> is this patchset still needed after Vicky's patch
> "[tpmdd-devel] Fix NULL return in tpm_ibmvtpm_get_desired_dma"
> https://patchwork.ozlabs.org/patch/402315/
>
> Ashley raised some concerns.
>
> Since merge window is coming up, a fast reply is appreciated.
We definitely need a way to catch an invalid driver data pointer, but it
looks like that needs to be reworked after Vicky's patch.
Vicky could you look at all uses of ibmvtpm_get_data and make
sure we don't blindly dereference it? eg:
static int tpm_ibmvtpm_resume(struct device *dev)
{
struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(dev);
...
rc = plpar_hcall_norets(H_ENABLE_CRQ,
ibmvtpm->vdev->unit_address);
Anton
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad
2014-12-02 21:20 ` Anton Blanchard
@ 2014-12-03 23:11 ` Hon Ching (Vicky) Lo
0 siblings, 0 replies; 13+ messages in thread
From: Hon Ching (Vicky) Lo @ 2014-12-03 23:11 UTC (permalink / raw)
To: Anton Blanchard
Cc: Peter Hüwe, Ashley Lai, Marcel Selhorst, tpmdd-devel,
linux-kernel
Hi Anton,
vio_bus_probe now calls vio_cmo_bus_probe before calling probe.
This results in calling get_desired_dma to get rtce buf size
before we have called probe which initializes vtpm driver and
sets up the tpm data, i.e. rtce buf size.
ibmvtpm_get_data returns NULL in get_desired_dma is a special
case where the device is not initialized.
Regards,
Vicky
On Wed, 2014-12-03 at 08:20 +1100, Anton Blanchard wrote:
> Hi,
>
> > is this patchset still needed after Vicky's patch
> > "[tpmdd-devel] Fix NULL return in tpm_ibmvtpm_get_desired_dma"
> > https://patchwork.ozlabs.org/patch/402315/
> >
> > Ashley raised some concerns.
> >
> > Since merge window is coming up, a fast reply is appreciated.
>
> We definitely need a way to catch an invalid driver data pointer, but it
> looks like that needs to be reworked after Vicky's patch.
>
> Vicky could you look at all uses of ibmvtpm_get_data and make
> sure we don't blindly dereference it? eg:
>
> static int tpm_ibmvtpm_resume(struct device *dev)
> {
> struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(dev);
> ...
>
> rc = plpar_hcall_norets(H_ENABLE_CRQ,
> ibmvtpm->vdev->unit_address);
>
> Anton
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-12-03 23:11 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19 21:29 [PATCH 1/2] tpm/tpm_ibmvtpm: Fail in ibmvtpm_get_data if driver_data is bad 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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.