public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Xiaolong Huang <butterflyhuangxx@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, baolin.wang@linux.alibaba.com,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] ALSA: rawmidi: fix infoleak in snd_rawmidi_ioctl_status_compat64
Date: Wed, 23 Nov 2022 07:55:56 +0100	[thread overview]
Message-ID: <87mt8i5fcz.wl-tiwai@suse.de> (raw)
In-Reply-To: <20221123050911.1045190-1-butterflyhuangxx@gmail.com>

On Wed, 23 Nov 2022 06:09:11 +0100,
Xiaolong Huang wrote:
> 
> The compat_status is declared off of the stack, so it needs to
> be zeroed out before copied back to userspace to prevent any
> unintentional data leakage.
> 
> Fixes: d9e5582c4bb2 ("ALSA: Avoid using timespec for struct snd_rawmidi_status")
> Signed-off-by: Xiaolong Huang <butterflyhuangxx@gmail.com>
> 
> ---
> 
> Reason for resend:
> 1. add Fixes line.
> ---
>  sound/core/rawmidi_compat.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/core/rawmidi_compat.c b/sound/core/rawmidi_compat.c
> index 68a93443583c..6afa68165b17 100644
> --- a/sound/core/rawmidi_compat.c
> +++ b/sound/core/rawmidi_compat.c
> @@ -80,6 +80,7 @@ static int snd_rawmidi_ioctl_status_compat64(struct snd_rawmidi_file *rfile,
>  	if (err < 0)
>  		return err;
>  
> +	memset(&compat_status, 0, sizeof(compat_status));
>  	compat_status = (struct compat_snd_rawmidi_status64) {
>  		.stream = status.stream,
>  		.tstamp_sec = status.tstamp_sec,

Here at the line just after your addition, compat_status is fully
initialized by substitution, so I believe the memset is superfluous.

Or have you verified that it really leaks the uninitialized memory?


thanks,

Takashi

  reply	other threads:[~2022-11-23  6:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  5:09 [RESEND PATCH] ALSA: rawmidi: fix infoleak in snd_rawmidi_ioctl_status_compat64 Xiaolong Huang
2022-11-23  6:55 ` Takashi Iwai [this message]
2022-11-23  7:06   ` butt3rflyh4ck
2022-11-23  7:17     ` 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=87mt8i5fcz.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=butterflyhuangxx@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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