linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srikanth K H <srikanth.h@samsung.com>
To: mcgrof@kernel.org, keescook@chromium.org, adobriyan@gmail.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: srikanth.h@samsung.com
Subject: [PATCH 1/1] Preventive patch in the proc file-system to handle NULL check.
Date: Thu, 16 Aug 2018 15:04:13 +0530	[thread overview]
Message-ID: <1534412053-22457-1-git-send-email-srikanth.h@samsung.com> (raw)
In-Reply-To: CGME20180816093424epcas2p25ede075fec715ad31108360ddca9cce8@epcas2p2.samsung.com

If the make directory for "sys" interface fail's then its
dereferenced without even checking for its validity which
will lead to crash, hence added preventive code to check
for NULL and accordingly dereference.

Signed-off-by: Srikanth K H <srikanth.h@samsung.com>
---
 fs/proc/proc_sysctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 89921a0..320884b 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1692,6 +1692,8 @@ int __init proc_sys_init(void)
 	struct proc_dir_entry *proc_sys_root;
 
 	proc_sys_root = proc_mkdir("sys", NULL);
+	if (!proc_sys_root)
+		return -ENOMEM;
 	proc_sys_root->proc_iops = &proc_sys_dir_operations;
 	proc_sys_root->proc_fops = &proc_sys_dir_file_operations;
 	proc_sys_root->nlink = 0;
-- 
1.9.1


       reply	other threads:[~2018-08-16  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180816093424epcas2p25ede075fec715ad31108360ddca9cce8@epcas2p2.samsung.com>
2018-08-16  9:34 ` Srikanth K H [this message]
2018-08-16 12:32   ` [PATCH 1/1] Preventive patch in the proc file-system to handle NULL check Alexey Dobriyan
2018-08-16 13:17   ` Luis Chamberlain
     [not found]   ` <CGME20180816093424epcas2p25ede075fec715ad31108360ddca9cce8@epcms5p8>
2018-08-17  3:21     ` Srikanth Korangala Hari
2018-08-17  3:36       ` Al Viro
     [not found]   ` <CGME20180816093424epcas2p25ede075fec715ad31108360ddca9cce8@epcms5p1>
2018-08-17  3:27     ` Srikanth Korangala Hari

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=1534412053-22457-1-git-send-email-srikanth.h@samsung.com \
    --to=srikanth.h@samsung.com \
    --cc=adobriyan@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.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;
as well as URLs for NNTP newsgroup(s).