Skip to contentSkip to conversation

tpm: fix panic caused by "tpm: Autodetect itpm devices"

PATCH In review Olof Johansson 3 participants 6 messages Jan 7, 2011 – Jan 26, 2011 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: fix panic caused by "tpm: Autodetect itpm devices"

commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 adds a check for PNP device id to the common tpm_tis_init() function, which in some cases (force=1) will be called without the device being a member of a pnp_dev. Oopsing and panics ensue.

Move the test up to before the call to tpm_tis_init(), since it just modifies a global variable anyway.

Cc Matthew Garrett <[email protected]>
Cc [email protected] [2.6.37+]
---
 drivers/char/tpm/tpm_tis.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis.c +3 -3
index c17a305..dd21df5 100644
@@ -493,9 +493,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 		 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
 		 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
 
-	if (is_itpm(to_pnp_dev(dev)))
-		itpm = 1;
-
 	if (itpm)
 		dev_info(dev, "Intel iTPM workaround enabled\n");
 
@@ -637,6 +634,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 	else
 		interrupts = 0;
 
+	if (is_itpm(pnp_dev))
+		itpm = 1;
+
 	return tpm_tis_init(&pnp_dev->dev, start, len, irq);
 }
 
Signature · 1 line
1.7.3.GIT
#1 lore raw

Are all TPM maintainers MIA? This is a trivial patch that fixes a panic, and it was a late-added regression in 2.6.37.

-Olof

Quoted 48 lines · Olof Johansson

commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 adds a check for PNP device id to the common tpm_tis_init() function, which in some cases (force=1) will be called without the device being a member of a pnp_dev. Oopsing and panics ensue.

Move the test up to before the call to tpm_tis_init(), since it just modifies a global variable anyway.

Cc Matthew Garrett <[email protected]>
Cc [email protected] [2.6.37+]

---
 drivers/char/tpm/tpm_tis.c |    6 +++---

 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis.c +0 -3
index c17a305..dd21df5 100644
@@ -493,9 +493,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
                 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
                 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
 
-       if (is_itpm(to_pnp_dev(dev)))
-               itpm = 1;
-
        if (itpm)
                dev_info(dev, "Intel iTPM workaround enabled\n");
 
@@ -637,6 +634,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,

       else
               interrupts = 0;

+       if (is_itpm(pnp_dev))
+               itpm = 1;
+
       return tpm_tis_init(&pnp_dev->dev, start, len, irq); }

--
1.7.3.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Acked-by
#2 lore raw
Quoted 3 lines · Olof Johansson

Are all TPM maintainers MIA? This is a trivial patch that fixes a panic, and it was a late-added regression in 2.6.37.

Not myself. I missed this one unfortunately in my work queue, sorry, will keep alert to avoid this happening again.

Quoted 51 lines

-Olof

Quoted 48 lines · Olof Johansson

commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 adds a check for PNP device id to the common tpm_tis_init() function, which in some cases (force=1) will be called without the device being a member of a pnp_dev. Oopsing and panics ensue.

Move the test up to before the call to tpm_tis_init(), since it just modifies a global variable anyway.

Cc Matthew Garrett<[email protected]>
Cc [email protected] [2.6.37+]
---
  drivers/char/tpm/tpm_tis.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis.c +3 -4
index c17a305..dd21df5 100644
@@ -493,9 +493,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
                 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
                 vendor>>  16, ioread8(chip->vendor.iobase + TPM_RID(0)));
 
-       if (is_itpm(to_pnp_dev(dev)))
-               itpm = 1;
-
        if (itpm)
                dev_info(dev, "Intel iTPM workaround enabled\n");
 
@@ -637,6 +634,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
        else
                interrupts = 0;
 
+       if (is_itpm(pnp_dev))
+               itpm = 1;
+
        return tpm_tis_init(&pnp_dev->dev, start, len, irq);
  }
 
--

1.7.3.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 8 lines · Rajiv Andrade
Quoted 3 lines · Olof Johansson

Are all TPM maintainers MIA? This is a trivial patch that fixes a panic, and it was a late-added regression in 2.6.37.

Not myself. I missed this one unfortunately in my work queue, sorry, will keep alert to avoid this happening again.

Rajiv,

I've mentioned this at least once before: as maintainer of TPM, ideally, what you should be doing is collecting the TPM patches, testing them in your own tree, then pushing them to me with an indication of where they need to end up (e.g. bugfixes for current linus vs. next), preferably via git.

This is a significant part of what distinguishes maintainership from simply developing or reviewing code.

- James

Signature · 2 lines
James Morris
<[email protected]>
#4 lore raw
Quoted 18 lines · James Morris
Quoted 8 lines · Rajiv Andrade
Quoted 3 lines · Olof Johansson

Are all TPM maintainers MIA? This is a trivial patch that fixes a panic, and it was a late-added regression in 2.6.37.

Not myself. I missed this one unfortunately in my work queue, sorry, will keep alert to avoid this happening again.

Rajiv,

I've mentioned this at least once before: as maintainer of TPM, ideally, what you should be doing is collecting the TPM patches, testing them in your own tree, then pushing them to me with an indication of where they need to end up (e.g. bugfixes for current linus vs. next), preferably via git.

Quoted 5 lines

This is a significant part of what distinguishes maintainership from simply developing or reviewing code.

- James

Sorry for the delays, I'm setting up a git tree now. Thanks for the heads up.

Rajiv

#5 lore raw
In reply to Olof Johansson
Quoted 8 lines · Olof Johansson
Quoted 7 lines · Olof Johansson

commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 adds a check for PNP device id to the common tpm_tis_init() function, which in some cases (force=1) will be called without the device being a member of a pnp_dev. Oopsing and panics ensue.

Move the test up to before the call to tpm_tis_init(), since it just modifies a global variable anyway.

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#for-linus

Signature · 2 lines
James Morris
<[email protected]>