From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
Clemens Ladisch <clemens@ladisch.de>,
Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ALSA: bebob: potential info leak in hwdep_read()
Date: Wed, 7 Oct 2020 22:04:37 +0900 [thread overview]
Message-ID: <20201007130437.GA73459@workstation> (raw)
In-Reply-To: <20201007074928.GA2529578@mwanda>
Hi,
Thanks for the patch.
On Wed, Oct 07, 2020 at 10:49:28AM +0300, Dan Carpenter wrote:
> The "count" variable needs to be capped on every path so that we don't
> copy too much information to the user.
>
> Fixes: 618eabeae711 ("ALSA: bebob: Add hwdep interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> sound/firewire/bebob/bebob_hwdep.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c
> index 45b740f44c45..c362eb38ab90 100644
> --- a/sound/firewire/bebob/bebob_hwdep.c
> +++ b/sound/firewire/bebob/bebob_hwdep.c
> @@ -36,12 +36,11 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
> }
>
> memset(&event, 0, sizeof(event));
> + count = min_t(long, count, sizeof(event.lock_status));
> if (bebob->dev_lock_changed) {
> event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS;
> event.lock_status.status = (bebob->dev_lock_count > 0);
> bebob->dev_lock_changed = false;
> -
> - count = min_t(long, count, sizeof(event.lock_status));
> }
>
> spin_unlock_irq(&bebob->lock);
> --
> 2.28.0
Indeed, the bug can leak the contents of kernel memory into user space
unintentionally for the size indicated by ALSA HwDep application...
I will check the other drivers in ALSA firewire stack later for safe.
Thanks
Takashi Sakamoto
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
Clemens Ladisch <clemens@ladisch.de>,
Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ALSA: bebob: potential info leak in hwdep_read()
Date: Wed, 07 Oct 2020 13:04:37 +0000 [thread overview]
Message-ID: <20201007130437.GA73459@workstation> (raw)
In-Reply-To: <20201007074928.GA2529578@mwanda>
Hi,
Thanks for the patch.
On Wed, Oct 07, 2020 at 10:49:28AM +0300, Dan Carpenter wrote:
> The "count" variable needs to be capped on every path so that we don't
> copy too much information to the user.
>
> Fixes: 618eabeae711 ("ALSA: bebob: Add hwdep interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> sound/firewire/bebob/bebob_hwdep.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c
> index 45b740f44c45..c362eb38ab90 100644
> --- a/sound/firewire/bebob/bebob_hwdep.c
> +++ b/sound/firewire/bebob/bebob_hwdep.c
> @@ -36,12 +36,11 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
> }
>
> memset(&event, 0, sizeof(event));
> + count = min_t(long, count, sizeof(event.lock_status));
> if (bebob->dev_lock_changed) {
> event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS;
> event.lock_status.status = (bebob->dev_lock_count > 0);
> bebob->dev_lock_changed = false;
> -
> - count = min_t(long, count, sizeof(event.lock_status));
> }
>
> spin_unlock_irq(&bebob->lock);
> --
> 2.28.0
Indeed, the bug can leak the contents of kernel memory into user space
unintentionally for the size indicated by ALSA HwDep application...
I will check the other drivers in ALSA firewire stack later for safe.
Thanks
Takashi Sakamoto
next prev parent reply other threads:[~2020-10-07 13:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 7:49 [PATCH] ALSA: bebob: potential info leak in hwdep_read() Dan Carpenter
2020-10-07 7:49 ` Dan Carpenter
2020-10-07 13:04 ` Takashi Sakamoto [this message]
2020-10-07 13:04 ` Takashi Sakamoto
2020-10-07 15:23 ` Takashi Sakamoto
2020-10-07 15:23 ` Takashi Sakamoto
2020-10-07 15:34 ` Takashi Iwai
2020-10-07 15:34 ` 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=20201007130437.GA73459@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--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 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.