提交 43fe105a 编写于 作者: J Jean Delvare 提交者: Linus Torvalds

dmi: prevent linked list corruption

Adding the same item to a given linked list more than once is guaranteed
to break and corrupt the list.  This is however what we do in dmi_scan
since commit 79da4721 ("x86: fix DMI out
of memory problems").

Given that there is absolutely no interest in saving empty OEM strings
anyway, I propose the simple and efficient fix below: we discard the empty
OEM strings altogether.
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Acked-by: NParag Warudkar <parag.warudkar@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 79306a34
......@@ -217,10 +217,6 @@ static void __init dmi_save_devices(const struct dmi_header *dm)
}
}
static struct dmi_device empty_oem_string_dev = {
.name = dmi_empty_string,
};
static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
{
int i, count = *(u8 *)(dm + 1);
......@@ -229,10 +225,8 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
for (i = 1; i <= count; i++) {
char *devname = dmi_string(dm, i);
if (!strcmp(devname, dmi_empty_string)) {
list_add(&empty_oem_string_dev.list, &dmi_devices);
if (devname == dmi_empty_string)
continue;
}
dev = dmi_alloc(sizeof(*dev));
if (!dev) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册