public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	Adrian Knoth <adi@drcomp.erfurt.thur.de>,
	Florian Faber <faber@faberman.de>,
	Fredrik Lingvall <fredrik.lingvall@gmail.com>
Subject: Re: [patch 1/2] ALSA: hdspm - potential info leak in snd_hdspm_hwdep_ioctl()
Date: Fri, 23 Sep 2011 06:31:50 +0000	[thread overview]
Message-ID: <s5hk48zg46h.wl%tiwai@suse.de> (raw)
In-Reply-To: <20110923062421.GI4387@elgon.mountain>

At Fri, 23 Sep 2011 09:24:21 +0300,
Dan Carpenter wrote:
> 
> Smatch has a new check for Rosenberg type information leaks where
> structs are copied to the user with uninitialized stack data in them.
> 
> The status struct has a hole in it, and on some paths not all the
> members were initialized.
> 
> struct hdspm_status {
>         unsigned char              card_type;            /*     0     1 */
>         /* XXX 3 bytes hole, try to pack */
>         enum hdspm_syncsource      autosync_source;      /*     4     4 */
>         long long unsigned int     card_clock;           /*     8     8 */
> 
> The hdspm_version struct had holes in it as well.
> 
> struct hdspm_version {
>         unsigned char              card_type;            /*     0     1 */
>         char                       cardname[20];         /*     1    20 */
>         /* XXX 3 bytes hole, try to pack */
>         unsigned int               serial;               /*    24     4 */
>         short unsigned int         firmware_rev;         /*    28     2 */
>         /* XXX 2 bytes hole, try to pack */
>         int                        addons;               /*    32     4 */
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied now.  Thanks.


Takashi


> diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
> index 214110d..bf438d1 100644
> --- a/sound/pci/rme9652/hdspm.c
> +++ b/sound/pci/rme9652/hdspm.c
> @@ -6227,6 +6227,8 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
>  		break;
>  
>  	case SNDRV_HDSPM_IOCTL_GET_STATUS:
> +		memset(&status, 0, sizeof(status));
> +
>  		status.card_type = hdspm->io_type;
>  
>  		status.autosync_source = hdspm_autosync_ref(hdspm);
> @@ -6266,6 +6268,8 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
>  		break;
>  
>  	case SNDRV_HDSPM_IOCTL_GET_VERSION:
> +		memset(&hdspm_version, 0, sizeof(hdspm_version));
> +
>  		hdspm_version.card_type = hdspm->io_type;
>  		strncpy(hdspm_version.cardname, hdspm->card_name,
>  				sizeof(hdspm_version.cardname));
> 

      reply	other threads:[~2011-09-23  6:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23  6:24 [patch 1/2] ALSA: hdspm - potential info leak in Dan Carpenter
2011-09-23  6:31 ` Takashi Iwai [this message]

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=s5hk48zg46h.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=adi@drcomp.erfurt.thur.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    --cc=faber@faberman.de \
    --cc=fredrik.lingvall@gmail.com \
    --cc=kernel-janitors@vger.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