Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp888420yba; Thu, 18 Apr 2019 11:14:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzveEQbiDyUEYu6FNEXD5ykYH/8ClxptHN/xH9tgOE5oJ4bAOj70KowJxxbJzVy053vuzFZ X-Received: by 2002:a17:902:f209:: with SMTP id gn9mr49144022plb.109.1555611287681; Thu, 18 Apr 2019 11:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611287; cv=none; d=google.com; s=arc-20160816; b=bnvKRNKc8TGkbIJUlPv1BJokP3A5dVGVa2Drlhtb/I4GIAmMcrGX5EaotbwIii4SaR Bmfdrr3qjake2uKfe5TRQ4EtErfoud083IFXBTcSLemIZKPxYG/Wi/qs5OBAqBEqj9Ee 5++D/Oq0F8+BF+Y9+dRYaw6sPycDUO8SD/VaK4437yUgFeUD4eFiWE4axaRBIloFM25Q nwmUNUAp+sYQj5Z5anCXTvc5P2xHoAAP1U0y5YiX8vTrRkTG1wL4+hePfR55+qHEYMc8 5tbIJpsfMxywXhFosKvhsTBGDhqFM3YTQ3+nGEaVjyISkgdstlvUkcI2LHUwEnulNJ/M AATw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yr9H42rN4s0t/gxOeSZufqDofaoWht3U1qUC5xkE3kg=; b=zSYV7/D5zoW5X6KqN3IpZupEczmnCALXNkYC89oeP34LM/PnSbgvBP9q3n3qXT0yP5 9/0jG1WV8R/p1nYKmV3PCHltg8nGNlXjVLHJny0kNB2w+/8JgDZQDO/dZ2EO0Sp1N8ru xikoe/0UOZ1GCDAwBJIzH1w8SehD07PzQxguYNXsGiQpHncQK/ysAMpksmOSMhrQvk5W hiWfTgjfz0pxfrgjycsG37YmKT6u+FlfvTlAKKUJJkyVi0LQBcnBpn9J9uUo8lFyv3Co rS7ZGMY5X+4/6X7NAor5gAZNeVHOG1cy7gvMZ41akP1KbZBx+M8B+/aXMdyHtzicn2jS hcHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u91+xiIJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y29si2579012pgk.120.2019.04.18.11.14.32; Thu, 18 Apr 2019 11:14:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u91+xiIJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391928AbfDRSLh (ORCPT + 99 others); Thu, 18 Apr 2019 14:11:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404254AbfDRSLg (ORCPT ); Thu, 18 Apr 2019 14:11:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0617E20675; Thu, 18 Apr 2019 18:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611095; bh=LhcowETXqCJjPfg+8BoraNfngeOLBDItV9NMMOH5dwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u91+xiIJ4+xaUrtpuODkjXA9yKpzWY4eKjoEhhPCrbhfcGUBOrdj98AC+mvmE/mmP Huw/fDbwsfsKpvM5FzDai6rU3vAVtq0S+pOG0Rj+pMSA5IijfAbW6Qwpfkh8OSM1gN D/zWMJdXY4xdUdNJT6tKJksYY/RAIqj7SR1QMVx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aditya Pakki , Thomas Gleixner , kjlu@umn.edu, Borislav Petkov , "H. Peter Anvin" , Kees Cook , Joe Perches , Nicolai Stange , Roland Dreier , Sasha Levin Subject: [PATCH 5.0 56/93] x86/hpet: Prevent potential NULL pointer dereference Date: Thu, 18 Apr 2019 19:57:34 +0200 Message-Id: <20190418160443.244038533@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2e84f116afca3719c9d0a1a78b47b48f75fd5724 ] hpet_virt_address may be NULL when ioremap_nocache fail, but the code lacks a check. Add a check to prevent NULL pointer dereference. Signed-off-by: Aditya Pakki Signed-off-by: Thomas Gleixner Cc: kjlu@umn.edu Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Kees Cook Cc: Joe Perches Cc: Nicolai Stange Cc: Roland Dreier Link: https://lkml.kernel.org/r/20190319021958.17275-1-pakki001@umn.edu Signed-off-by: Sasha Levin --- arch/x86/kernel/hpet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index dfd3aca82c61..fb32925a2e62 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -905,6 +905,8 @@ int __init hpet_enable(void) return 0; hpet_set_mapping(); + if (!hpet_virt_address) + return 0; /* * Read the period and check for a sane value: -- 2.19.1