All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dimitri Sivanich <sivanich@sgi.com>, Robin Holt <holt@sgi.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] gru: info leak in gru_get_config_info()
Date: Sun, 21 Apr 2013 11:56:57 +0000	[thread overview]
Message-ID: <5173D409.8010405@bfs.de> (raw)
In-Reply-To: <20130421111031.GE6171@elgon.mountain>



Am 21.04.2013 13:10, schrieb Dan Carpenter:
> The "info.fill" array isn't initialized so it can leak uninitialized
> stack information to user space.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
> index 44d273c..ed5fc43 100644
> --- a/drivers/misc/sgi-gru/grufile.c
> +++ b/drivers/misc/sgi-gru/grufile.c
> @@ -176,6 +176,7 @@ static long gru_get_config_info(unsigned long arg)
>  	info.nodes = num_online_nodes();
>  	info.blades = info.nodes / nodesperblade;
>  	info.chiplets = GRU_CHIPLETS_PER_BLADE * info.blades;
> +	memset(&info.fill, 0, sizeof(info.fill));
>  

the other way around (clear first all bytes) looks more easy
in case someone will add more elements to the struct.

memset(&info, 0, sizeof(info));
info.nodes = num_online_nodes();
info.blades = info.nodes / nodesperblade;
....

re,
 wh


>  	if (copy_to_user((void __user *)arg, &info, sizeof(info)))
>  		return -EFAULT;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dimitri Sivanich <sivanich@sgi.com>, Robin Holt <holt@sgi.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] gru: info leak in gru_get_config_info()
Date: Sun, 21 Apr 2013 13:56:57 +0200	[thread overview]
Message-ID: <5173D409.8010405@bfs.de> (raw)
In-Reply-To: <20130421111031.GE6171@elgon.mountain>



Am 21.04.2013 13:10, schrieb Dan Carpenter:
> The "info.fill" array isn't initialized so it can leak uninitialized
> stack information to user space.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
> index 44d273c..ed5fc43 100644
> --- a/drivers/misc/sgi-gru/grufile.c
> +++ b/drivers/misc/sgi-gru/grufile.c
> @@ -176,6 +176,7 @@ static long gru_get_config_info(unsigned long arg)
>  	info.nodes = num_online_nodes();
>  	info.blades = info.nodes / nodesperblade;
>  	info.chiplets = GRU_CHIPLETS_PER_BLADE * info.blades;
> +	memset(&info.fill, 0, sizeof(info.fill));
>  

the other way around (clear first all bytes) looks more easy
in case someone will add more elements to the struct.

memset(&info, 0, sizeof(info));
info.nodes = num_online_nodes();
info.blades = info.nodes / nodesperblade;
....

re,
 wh


>  	if (copy_to_user((void __user *)arg, &info, sizeof(info)))
>  		return -EFAULT;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2013-04-21 11:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 11:10 [patch] gru: info leak in gru_get_config_info() Dan Carpenter
2013-04-21 11:10 ` Dan Carpenter
2013-04-21 11:56 ` walter harms [this message]
2013-04-21 11:56   ` walter harms
2013-04-21 13:19   ` Robin Holt
2013-04-21 13:19     ` Robin Holt
2013-04-21 17:01     ` [patch v2] " Dan Carpenter
2013-04-21 17:01       ` Dan Carpenter
2013-04-21 17:33       ` Dimitri Sivanich
2013-04-21 17:33         ` Dimitri Sivanich
2013-04-22 16:41         ` Robin Holt
2013-04-22 16:41           ` Robin Holt

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=5173D409.8010405@bfs.de \
    --to=wharms@bfs.de \
    --cc=dan.carpenter@oracle.com \
    --cc=holt@sgi.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sivanich@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.