All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] ALSA: info: Avoid leaking kernel memory
Date: Thu, 14 Mar 2013 07:15:28 +0100	[thread overview]
Message-ID: <51416B00.2040406@canonical.com> (raw)
In-Reply-To: <1363192600-11832-1-git-send-email-tiwai@suse.de>

On 03/13/2013 05:36 PM, Takashi Iwai wrote:
> Make sure that the allocated buffer for reading the proc file won't
> expose the uncleared kernel memory.

This should go to stable too, due to the security implications of 
leaking possibly sensitive information to userspace?

>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>   sound/core/info.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/core/info.c b/sound/core/info.c
> index db308db..58e97b3 100644
> --- a/sound/core/info.c
> +++ b/sound/core/info.c
> @@ -89,7 +89,7 @@ static int resize_info_buffer(struct snd_info_buffer *buffer,
>   	char *nbuf;
>
>   	nsize = PAGE_ALIGN(nsize);
> -	nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL);
> +	nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL | __GFP_ZERO);
>   	if (! nbuf)
>   		return -ENOMEM;
>
> @@ -353,7 +353,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
>   				goto __nomem;
>   			data->rbuffer = buffer;
>   			buffer->len = PAGE_SIZE;
> -			buffer->buffer = kmalloc(buffer->len, GFP_KERNEL);
> +			buffer->buffer = kzalloc(buffer->len, GFP_KERNEL);
>   			if (buffer->buffer == NULL)
>   				goto __nomem;
>   		}
>



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

  parent reply	other threads:[~2013-03-14  6:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 16:36 [PATCH 1/2] ALSA: info: Avoid leaking kernel memory Takashi Iwai
2013-03-13 16:36 ` [PATCH 2/2] ALSA: info: Small refactoring and a sanity check in snd_info_get_line() Takashi Iwai
2013-03-14  6:15 ` David Henningsson [this message]
2013-03-14  6:49   ` [PATCH 1/2] ALSA: info: Avoid leaking kernel memory Takashi Iwai

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=51416B00.2040406@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.