* [PATCH] x86: hpet: Fix to avoid potential NULL pointer dereference
@ 2019-03-19 2:19 Aditya Pakki
2019-03-21 11:29 ` [tip:x86/urgent] x86/hpet: Prevent " tip-bot for Aditya Pakki
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-19 2:19 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, x86, Kees Cook, Joe Perches, Nicolai Stange,
Roland Dreier, linux-kernel
hpet_virt_address may be NULL when ioremap_nocache fails. The patch
checks for such a scenario and avoids NULL pointer dereference.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:x86/urgent] x86/hpet: Prevent potential NULL pointer dereference
2019-03-19 2:19 [PATCH] x86: hpet: Fix to avoid potential NULL pointer dereference Aditya Pakki
@ 2019-03-21 11:29 ` tip-bot for Aditya Pakki
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Aditya Pakki @ 2019-03-21 11:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, keescook, pakki001, mingo, bp, tglx, linux-kernel, roland,
nstange, joe
Commit-ID: 2e84f116afca3719c9d0a1a78b47b48f75fd5724
Gitweb: https://git.kernel.org/tip/2e84f116afca3719c9d0a1a78b47b48f75fd5724
Author: Aditya Pakki <pakki001@umn.edu>
AuthorDate: Mon, 18 Mar 2019 21:19:56 -0500
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 21 Mar 2019 12:24:38 +0100
x86/hpet: Prevent potential NULL pointer dereference
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 <pakki001@umn.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: kjlu@umn.edu
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: Nicolai Stange <nstange@suse.de>
Cc: Roland Dreier <roland@purestorage.com>
Link: https://lkml.kernel.org/r/20190319021958.17275-1-pakki001@umn.edu
---
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:
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-21 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 2:19 [PATCH] x86: hpet: Fix to avoid potential NULL pointer dereference Aditya Pakki
2019-03-21 11:29 ` [tip:x86/urgent] x86/hpet: Prevent " tip-bot for Aditya Pakki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).