Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759412AbYBKRYu (ORCPT ); Mon, 11 Feb 2008 12:24:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756638AbYBKRYn (ORCPT ); Mon, 11 Feb 2008 12:24:43 -0500 Received: from smtp-101-monday.nerim.net ([62.4.16.101]:61110 "EHLO kraid.nerim.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753774AbYBKRYm (ORCPT ); Mon, 11 Feb 2008 12:24:42 -0500 Date: Mon, 11 Feb 2008 18:24:40 +0100 From: Jean Delvare To: LKML Cc: Parag Warudkar , Ingo Molnar , Thomas Gleixner Subject: [PATCH] dmi: Prevent linked list corruption (resent) Message-ID: <20080211182440.071c47d9@hyperion.delvare> In-Reply-To: <20080211182235.14a5a641@hyperion.delvare> References: <20080211182235.14a5a641@hyperion.delvare> X-Mailer: Sylpheed-Claws 2.5.5 (GTK+ 2.10.6; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1752 Lines: 51 [Once more without forgetting the last "quilt refresh", sorry.] 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 79da4721117fcf188b4b007b775738a530f574da. 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: Jean Delvare Cc: Parag Warudkar Cc: Ingo Molnar Cc: Thomas Gleixner --- drivers/firmware/dmi_scan.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) --- linux-2.6.25-rc1.orig/drivers/firmware/dmi_scan.c 2008-02-11 16:15:10.000000000 +0100 +++ linux-2.6.25-rc1/drivers/firmware/dmi_scan.c 2008-02-11 18:04:18.000000000 +0100 @@ -217,10 +217,6 @@ static void __init dmi_save_devices(cons } } -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_ 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) { -- Jean Delvare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/