public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] init/main.c: check for null pointer before calling initcall
@ 2017-10-27 16:47 Abderrahmane Benbachir
  2017-10-27 18:02 ` David Daney
  0 siblings, 1 reply; 7+ messages in thread
From: Abderrahmane Benbachir @ 2017-10-27 16:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, akpm, tglx, keescook, jeyu, rostedt, mhocko, viresh.kumar,
	thomas.lendacky

Simple check to prevent kernel panic when initcall does not exit

Signed-off-by: Abderrahmane Benbachir <abderrahmane.benbachir@polymtl.ca>
---
 init/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/init/main.c b/init/main.c
index 0ee9c6866ada..220fd2822b61 100644
--- a/init/main.c
+++ b/init/main.c
@@ -817,6 +817,9 @@ int __init_or_module do_one_initcall(initcall_t fn)
 	int ret;
 	char msgbuf[64];
 
+	if (unlikely(!fn))
+		return -EFAULT;
+
 	if (initcall_blacklisted(fn))
 		return -EPERM;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-27 19:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27 16:47 [PATCH] init/main.c: check for null pointer before calling initcall Abderrahmane Benbachir
2017-10-27 18:02 ` David Daney
2017-10-27 18:22   ` Thomas Gleixner
2017-10-27 18:26     ` David Daney
2017-10-27 18:53       ` Abderrahmane Benbachir
2017-10-27 18:59         ` David Daney
2017-10-27 19:43         ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox