All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DMI: Always call dmi_present with DMI structure
@ 2013-02-20 18:12 H.J. Lu
  2013-02-21  2:58 ` Zhenzhong Duan
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2013-02-20 18:12 UTC (permalink / raw)
  To: LKML, Zhenzhong Duan

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]

Hi,

This patch:

commit 9f9c9cbb60576a1518d0bf93fb8e499cffccf377
Author: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Date:   Thu Dec 20 15:05:14 2012 -0800

    drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists

    The right dmi version is in SMBIOS if it's zero in DMI region

    This issue was originally found from an oracle bug.
    One customer noticed system UUID doesn't match between dmidecode & uek2.

     - HP ProLiant BL460c G6 :
       # cat /sys/devices/virtual/dmi/id/product_uuid
       00000000-0000-4C48-3031-4D5030333531
       # dmidecode | grep -i uuid    drivers/firmware/dmi_scan.c:
fetch dmi version from SMBIOS if it exists

    The right dmi version is in SMBIOS if it's zero in DMI region

    This issue was originally found from an oracle bug.
    One customer noticed system UUID doesn't match between dmidecode & uek2.

     - HP ProLiant BL460c G6 :
       # cat /sys/devices/virtual/dmi/id/product_uuid
       00000000-0000-4C48-3031-4D5030333531
       # dmidecode | grep -i uuid
       UUID: 00000000-0000-484C-3031-4D5030333531

    From SMBIOS 2.6 on, spec use little-endian encoding for UUID other than
    network byte order.

    So we need to get dmi version to distinguish.  If version is 0.0, the
    real version is taken from the SMBIOS version.  This is part of original
    kernel comment in code.

       UUID: 00000000-0000-484C-3031-4D5030333531

    From SMBIOS 2.6 on, spec use little-endian encoding for UUID other than
    network byte order.

    So we need to get dmi version to distinguish.  If version is 0.0, the
    real version is taken from the SMBIOS version.  This is part of original
    kernel comment in code.

causes a regression in 3.7, 3.8 and 3.9 kernels.   Before the change,
we only scan DMI structure.  Now smbios_present scans SMBIOS
entry point.  I have a machine which has invalid checksum in
SMBIOS entry point.  We wind up calling dmi_present with SMBIOS
entry point instead of DMI structure.  This patch changes smbios_present
to always call dmi_present with DMI structure.


-- 
H.J.

[-- Attachment #2: 0001-DMI-Always-call-dmi_present-with-DMI-structure.patch --]
[-- Type: application/octet-stream, Size: 1213 bytes --]

From 9de3769543bd35b75d8a4c549a23aa61abc3705c Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 20 Feb 2013 10:00:06 -0800
Subject: [PATCH] DMI: Always call dmi_present with DMI structure

If SMBIOS entry point has invalid checksum, smbios_present will call
dmi_present with wrong offset of DMI structure: 0, instead of 16.  We
should always call dmi_present with DMI structure.
---
 drivers/firmware/dmi_scan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 982f1f5..17073a8 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -442,7 +442,6 @@ static int __init dmi_present(const char __iomem *p)
 static int __init smbios_present(const char __iomem *p)
 {
 	u8 buf[32];
-	int offset = 0;
 
 	memcpy_fromio(buf, p, 32);
 	if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
@@ -461,9 +460,9 @@ static int __init smbios_present(const char __iomem *p)
 			dmi_ver = 0x0206;
 			break;
 		}
-		offset = 16;
 	}
-	return dmi_present(buf + offset);
+	/* 16 is the offset of _DMI_ string.  */
+	return dmi_present(buf + 16);
 }
 
 void __init dmi_scan_machine(void)
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-21 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 18:12 [PATCH] DMI: Always call dmi_present with DMI structure H.J. Lu
2013-02-21  2:58 ` Zhenzhong Duan
2013-02-21 19:06   ` H.J. Lu

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.