2011-06-01 06:44:41

by Alexander Stein

[permalink] [raw]
Subject: [PATCH] pch_phub: Don't panic if dmi_get_system_info returns NULL

Signed-off-by: Alexander Stein <[email protected]>
---
drivers/misc/pch_phub.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 5fe79df..01eb67b 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -686,6 +686,8 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
}

if (id->driver_data == 1) { /* EG20T PCH */
+ const char *board_name;
+
retval = sysfs_create_file(&pdev->dev.kobj,
&dev_attr_pch_mac.attr);
if (retval)
@@ -701,7 +703,8 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
CLKCFG_CANCLK_MASK);

/* quirk for CM-iTC board */
- if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
+ board_name = dmi_get_system_info(DMI_BOARD_NAME);
+ if (board_name && strstr(board_name, "CM-iTC"))
pch_phub_read_modify_write_reg(chip,
(unsigned int)CLKCFG_REG_OFFSET,
CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |
--
1.7.3.4


2011-06-16 07:26:45

by Alexander Stein

[permalink] [raw]
Subject: [PATCH v2] pch_phub: Don't oops if dmi_get_system_info returns NULL

If dmi_get_system_info() returns NULL, pch_phub_probe() will
dereferencea a zero pointer.

This oops was observed on an Atom based board which has no BIOS, but
a bootloder which doesn't privde DMI data.

Signed-off-by: Alexander Stein <[email protected]>
---
Changes in v2:
* Adjust summary
* Commit message is more verbose

drivers/misc/pch_phub.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 5fe79df..01eb67b 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -686,6 +686,8 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
}

if (id->driver_data == 1) { /* EG20T PCH */
+ const char *board_name;
+
retval = sysfs_create_file(&pdev->dev.kobj,
&dev_attr_pch_mac.attr);
if (retval)
@@ -701,7 +703,8 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
CLKCFG_CANCLK_MASK);

/* quirk for CM-iTC board */
- if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
+ board_name = dmi_get_system_info(DMI_BOARD_NAME);
+ if (board_name && strstr(board_name, "CM-iTC"))
pch_phub_read_modify_write_reg(chip,
(unsigned int)CLKCFG_REG_OFFSET,
CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |
--
1.7.3.4

2011-06-16 14:49:49

by Greg KH

[permalink] [raw]
Subject: Re: [stable] [PATCH v2] pch_phub: Don't oops if dmi_get_system_info returns NULL

On Thu, Jun 16, 2011 at 09:05:24AM +0200, Alexander Stein wrote:
> If dmi_get_system_info() returns NULL, pch_phub_probe() will
> dereferencea a zero pointer.
>
> This oops was observed on an Atom based board which has no BIOS, but
> a bootloder which doesn't privde DMI data.
>
> Signed-off-by: Alexander Stein <[email protected]>
> ---
> Changes in v2:
> * Adjust summary
> * Commit message is more verbose
>
> drivers/misc/pch_phub.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>