Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp712938lqb; Wed, 17 Apr 2024 08:42:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCq647tK/WuHQjSqazOKnh1Ew9VTQiKZ4wf18lSgq2T1EeGSs55F0nssPsplNHD6a31kzS1ddMIzy+dAg1Ha+Bo4f580VolYJc0iH3bw== X-Google-Smtp-Source: AGHT+IFrcBPdAWJhLmQm0cpbLqW0+qmVadDW23zJ+qnnhsb97MjbTDqpE/jw4x2Xgn1U4iCCoOjj X-Received: by 2002:a19:2d56:0:b0:518:8d15:8810 with SMTP id t22-20020a192d56000000b005188d158810mr8274365lft.14.1713368531149; Wed, 17 Apr 2024 08:42:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713368531; cv=pass; d=google.com; s=arc-20160816; b=a2/lR96WjiRKNnJocfQuYY9u3ch/mwq96RSH/tu5iOtTqfBnqhJfcPGMvqS3wP8X7w s8q6H8yXFz4YynRnSSKqrw4RWS9uSHNlvnqYewawXRWBjYlsgy9gchijSbbDXH+meyW4 Eb/rw37jZ96bxpDDmoRhGmstW+EQCOqpOcUP4zgPTjssT1d6rRjHUmISnrUHNasEFloi XnFVuuXuPfXeRQo6Yd+1C0DYPlUvDGWb3uKme3go2YfPUM/GQYFg93NYxsCmPuOMaV8h dP8EcUztz7O36CjvKAxQkKyxfhFp4m1ijUkokcfnAo/fINUUhKbfz635VtLBEkh6B0GA hgbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:cc:to:from :subject:message-id:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=VuKnNaKUeQ9SJ3jWfyd0fdlNcPS7skWvdmgj3sD0E3w=; fh=7IGgg3Js1zE+r9rW3loEiaODoaFPP9zCXJxwAA1QMqw=; b=NeJsxy8ljJk6gHghPYKdn/h5MTokFindb0011ZqhTsKGho3U+tU7ZDuVfpjxOzkeSp 4nEVa7mGXp+jqaYMEtoUv4Z8aY5Om0kfjCrxvQGobc2CBBhMVOTQiGv7E/a2UXMmODFG teLLUTklq6m0vlg3Q05lRGGYkc5tzfgH3c+VTn+9R5uJv5ZDcavbxg4CXwYkI6jlXk5f CpBRXGh/vOUyTfSkf2OPwNX69f1r6+lfCgiovSUdcZzSALif7mFHAQQ8fhYJRcTR9OV0 3qCuD1EUjZ3LxbuQNcYa/FfPUOBWVxqcuFpko6m08FIIhQld8djz8eFX2HnkyFyT5pwq sXmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=yh08Z7Ry; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=yh08Z7Ry; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-148811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ne40-20020a1709077ba800b00a5250fbded8si4995533ejc.74.2024.04.17.08.42.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 08:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=yh08Z7Ry; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=yh08Z7Ry; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-148811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C8C311F25021 for ; Wed, 17 Apr 2024 15:34:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E77DB146D4B; Wed, 17 Apr 2024 15:33:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="yh08Z7Ry"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/OjCaona"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="yh08Z7Ry"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/OjCaona" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78C09147C6D; Wed, 17 Apr 2024 15:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713368024; cv=none; b=NbiU31+cIHQTso6Y9u1Yp5FxwHlNGudUwUME3LP9WqZPyhYZ5zVA8XrwE3welnWyPM1MeSeCVkp83Xm/wgwpv4SQE4i4wfYQyKQDc3Okm/TkXPZiYVeN0l6Tvra2ihNNaUDAzEig4R2DBNZJYpBdDuq76OL8l08FO5f6dJqj6s8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713368024; c=relaxed/simple; bh=z4xdnmvSlM4ErphcHTjBQHmq8728znhdZOdtFL1RS9Q=; h=Message-ID:Subject:From:To:Cc:Date:Content-Type:MIME-Version; b=kJuztUVUb1DBlSOGgMVqU9LIDdQOYDtBWH0DbgbssQBLlSLZCsmcqSlxTBFz/Ve0EQVRtbIztG+IaThmKeY2qBk0Li+PmVHh3H1XI3VpvkQpDBE62Xp3KKbIdggkyfCj+9KojQBabGydh0iATZ9MOWqwu7+LjZJpqjHTBDJf1r8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=yh08Z7Ry; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/OjCaona; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=yh08Z7Ry; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/OjCaona; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 822CA33E51; Wed, 17 Apr 2024 15:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1713368015; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VuKnNaKUeQ9SJ3jWfyd0fdlNcPS7skWvdmgj3sD0E3w=; b=yh08Z7RyxeWTfmzuZreHxBUECDczM1rMSJas/xS8LSQa8/hjAsULZYOm0AWBQksb0i2Fvp gRoAhn1MAnCe25Ua1cCLCU/0/h4mV3Aczs0MRMuu0EvTtWJVXpcgZJtIjaBT1hFQljyPa2 FNXTK1er79ADShDGZoKtOsKt1WmdtUs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1713368015; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VuKnNaKUeQ9SJ3jWfyd0fdlNcPS7skWvdmgj3sD0E3w=; b=/OjCaona8ocShcErlgs0HFzuIFxMAOlRRtd+kf8/o9Cvmpxg68hyCGFMXe0ijcUVUVbRPX Q7aJkzp3+cVNzxBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1713368015; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VuKnNaKUeQ9SJ3jWfyd0fdlNcPS7skWvdmgj3sD0E3w=; b=yh08Z7RyxeWTfmzuZreHxBUECDczM1rMSJas/xS8LSQa8/hjAsULZYOm0AWBQksb0i2Fvp gRoAhn1MAnCe25Ua1cCLCU/0/h4mV3Aczs0MRMuu0EvTtWJVXpcgZJtIjaBT1hFQljyPa2 FNXTK1er79ADShDGZoKtOsKt1WmdtUs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1713368015; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VuKnNaKUeQ9SJ3jWfyd0fdlNcPS7skWvdmgj3sD0E3w=; b=/OjCaona8ocShcErlgs0HFzuIFxMAOlRRtd+kf8/o9Cvmpxg68hyCGFMXe0ijcUVUVbRPX Q7aJkzp3+cVNzxBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BEA871384C; Wed, 17 Apr 2024 15:33:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id TP+8J87rH2b8ZAAAD6G6ig (envelope-from ); Wed, 17 Apr 2024 15:33:34 +0000 Message-ID: Subject: [PATCH] firmware: dmi: Stop decoding on broken entry From: Jean Delvare To: Michael Schierl Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Kelley Date: Wed, 17 Apr 2024 17:33:32 +0200 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Flag: NO X-Spam-Score: -3.18 X-Spam-Level: X-Spamd-Result: default: False [-3.18 / 50.00]; BAYES_HAM(-1.88)[94.33%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmx.de,outlook.com]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_TO(0.00)[gmx.de]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,outlook.com]; RCPT_COUNT_THREE(0.00)[4]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] If a DMI table entry is shorter than 4 bytes, it is invalid. Due to how DMI table parsing works, it is impossible to safely recover from such an error, so we have to stop decoding the table. Signed-off-by: Jean Delvare Link: https://lore.kernel.org/linux-kernel/Zh2K3-HLXOesT_vZ@liuwe-devbox-debian-v2/T/ --- Michael, can you please test this patch and confirm that it prevents the early oops? The root cause of the DMI table corruption still needs to be investigated. drivers/firmware/dmi_scan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- linux-6.8.orig/drivers/firmware/dmi_scan.c +++ linux-6.8/drivers/firmware/dmi_scan.c @@ -102,6 +102,17 @@ static void dmi_decode_table(u8 *buf, const struct dmi_header *dm = (const struct dmi_header *)data; /* + * If a short entry is found (less than 4 bytes), not only it + * is invalid, but we cannot reliably locate the next entry. + */ + if (dm->length < sizeof(struct dmi_header)) { + pr_warn(FW_BUG + "Corrupted DMI table (only %d entries processed)\n", + i); + break; + } + + /* * We want to know the total length (formatted area and * strings) before decoding to make sure we won't run off the * table in dmi_decode or dmi_string -- Jean Delvare SUSE L3 Support