From: Abderrahmane Benbachir <abderrahmane.benbachir@polymtl.ca>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, akpm@linux-foundation.org, tglx@linutronix.de,
keescook@chromium.org, jeyu@redhat.com, rostedt@goodmis.org,
mhocko@suse.com, viresh.kumar@linaro.org,
thomas.lendacky@amd.com
Subject: [PATCH] init/main.c: check for null pointer before calling initcall
Date: Fri, 27 Oct 2017 12:47:27 -0400 [thread overview]
Message-ID: <1509122847.11787.5.camel@polymtl.ca> (raw)
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
next reply other threads:[~2017-10-27 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 16:47 Abderrahmane Benbachir [this message]
2017-10-27 18:02 ` [PATCH] init/main.c: check for null pointer before calling initcall 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509122847.11787.5.camel@polymtl.ca \
--to=abderrahmane.benbachir@polymtl.ca \
--cc=akpm@linux-foundation.org \
--cc=jeyu@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox