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

On Thu, Aug 16, 2018 at 03:04:13PM +0530, Srikanth K H wrote:
> 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.

> --- 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;

It is fine to crash because /proc is not modular.

  reply	other threads:[~2018-08-16 12:32 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 ` [PATCH 1/1] Preventive patch in the proc file-system to handle NULL check Srikanth K H
2018-08-16 12:32   ` Alexey Dobriyan [this message]
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=20180816123223.GA15817@avx2 \
    --to=adobriyan@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=srikanth.h@samsung.com \
    /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).