Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp894941pxy; Thu, 22 Apr 2021 16:34:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzckuJZEYhLpYNCAkon1PLWxr7QSh5gnk3YQPZ0SmXscA5knBYo+h2qKgFvkai782pzciW1 X-Received: by 2002:a17:90a:f0c8:: with SMTP id fa8mr2472955pjb.96.1619134460090; Thu, 22 Apr 2021 16:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619134460; cv=none; d=google.com; s=arc-20160816; b=O9onawZIwgcZ+SfwkPVXIcXArMDjcL2aYJ3E0jsXMl+yyxRRsIweMByOV2C7s8XD+N LJOb1sITIWJeTAnSO5BAAjmqCWdHayVbG/B5ZoZ39R8d3peFzYK5sLGJpoqV7TcMVrpB fgu41rLKkRBxox9Ukz+a4OVdXXxv1dPGJcuTHoqh8BGizTSiCb+NPLqd76hvseTYGME8 mPLmvaZwZBA/bZeCP57PLgyvGOp5tVkSku1pIxov/KoWu9QJ5k/+4lIXAeiay6g6kyFZ b4Locbr696Id9R90IUcfB03Qxilh2TLneEUKvJavgP8c0TKbX7hhbULUx1VzO/kC1F8U ylFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=+fylNxYaH0JYwbKxI3stgAYDYkyGd6MoaR6dJPTbGpQ=; b=R9O450UZHGMCUKKkNJxFtT6J8iecx2AfFLRRCLzdFJC3Hk0+m69ZCSz7/J+ecgjdRu ZwFEJCQS67vE3hsR1Py7n0vo0jCkWSijuaYcpkThtlq5fpDt0fuI0+3fht/scehSx54k tVRLWyqQVRtJY2IiHawJnP3uO0KDzqL4Bha17OQ9NILMtQ7ws6+ALNpiszrQ0xaf6W9+ 3GvfvKsOCfnYRUwrXp0mwHaT0rFiDzlX5RsHMei9NVO8bSy46KreJuOp/iTS5/oTUZ4I sVJeBkMcqc+GOHnBfqkDhCk/le0Cek5IojeMmuISLKjN3WWf0CNb72VP3Jc2Eki29Lah 6S9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jUTQP7Ln; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si5118625plb.38.2021.04.22.16.34.06; Thu, 22 Apr 2021 16:34:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jUTQP7Ln; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239881AbhDVXds (ORCPT + 99 others); Thu, 22 Apr 2021 19:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235977AbhDVXdr (ORCPT ); Thu, 22 Apr 2021 19:33:47 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39FADC061574 for ; Thu, 22 Apr 2021 16:33:12 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1619134388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+fylNxYaH0JYwbKxI3stgAYDYkyGd6MoaR6dJPTbGpQ=; b=jUTQP7LnAosuDNecCUqhZ0cblr5qPeVzpXA7zYERk5LWh2AlSTWHSInmZOXTCThBPE4Dqc +7Q8mGMnNlswSJoua8pWwfZ9ysiptSpGnLXzDnQyyLz9aWj4RcABPy/4vKya3oAwg3X8I9 SMbfmtKZcNy/DvxNoOVQO64IylfpG8gfVmMxs8bOPDahJ/GJpULn1Egir8IQJNDgSkd1Za fxfD0+KuJI29bWnjdmoBDQwrQ3schNwZPZMkvACHXbtZqpVIKVPMDq2Msd8Uf3EY7XqtRj MH1mJPvA74J8WEzr+iAqQh/7/Zv5hGVZj4J1uFv61zxJfIKfqVJz3e2ZrTVnKg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1619134388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+fylNxYaH0JYwbKxI3stgAYDYkyGd6MoaR6dJPTbGpQ=; b=p2qtviVpJrJrZF+kWsQu1d6pbK77d3cEMBxTb/iel8PnmHSXVngqdk/jwrqnQwvRW+khqY /Ez1q/RzaqdRJFBg== To: Kees Cook , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Aditya Pakki , kjlu@umn.edu, Borislav Petkov , "H. Peter Anvin" , Joe Perches , Nicolai Stange , Roland Dreier Subject: Re: [PATCH 113/190] Revert "x86/hpet: Prevent potential NULL pointer dereference" In-Reply-To: <202104211245.F5FEC8D15D@keescook> References: <20210421130105.1226686-1-gregkh@linuxfoundation.org> <20210421130105.1226686-114-gregkh@linuxfoundation.org> <202104211245.F5FEC8D15D@keescook> Date: Fri, 23 Apr 2021 01:33:07 +0200 Message-ID: <87im4dx5cc.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 21 2021 at 12:49, Kees Cook wrote: > On Wed, Apr 21, 2021 at 02:59:48PM +0200, Greg Kroah-Hartman wrote: >> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c >> index 08651a4e6aa0..0515a97bf6f5 100644 >> --- a/arch/x86/kernel/hpet.c >> +++ b/arch/x86/kernel/hpet.c >> @@ -930,8 +930,6 @@ int __init hpet_enable(void) >> return 0; >> >> hpet_set_mapping(); >> - if (!hpet_virt_address) >> - return 0; >> >> /* Validate that the config register is working */ >> if (!hpet_cfg_working()) > > FWIW, this patch looks harmless. It is checking for a failure in > hpet_set_mapping(), and avoids the following code from performing > 0-offset reads. hpet_set_mapping() is likely to never fail in real-world > situations. *shrug* 'likely never to fail' is clearly a receipe for disaster and you should know that. > I think it would make more sense for the check to live in > hpet_cfg_working(), though. No. That does not make any sense at all. The proper change would have been to make hpet_set_mapping() return an error/success code and act on that. But that does _NOT_ make the patch invalid. I'm pretty sure that I looked at it and thought about the proper solution (see above) and then shrugged it off because of overload... Thanks, tglx