* [PATCH] ALSA: bebob: potential info leak in hwdep_read()
@ 2020-10-07 7:49 Dan Carpenter
2020-10-07 13:04 ` Takashi Sakamoto
2020-10-07 15:34 ` Takashi Iwai
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-10-07 7:49 UTC (permalink / raw)
To: Clemens Ladisch, Takashi Sakamoto
Cc: alsa-devel, kernel-janitors, Takashi Iwai
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: bebob: potential info leak in hwdep_read()
2020-10-07 7:49 [PATCH] ALSA: bebob: potential info leak in hwdep_read() Dan Carpenter
@ 2020-10-07 13:04 ` Takashi Sakamoto
2020-10-07 15:23 ` Takashi Sakamoto
2020-10-07 15:34 ` Takashi Iwai
1 sibling, 1 reply; 4+ messages in thread
From: Takashi Sakamoto @ 2020-10-07 13:04 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors, alsa-devel, Clemens Ladisch, Takashi Iwai
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: bebob: potential info leak in hwdep_read()
2020-10-07 13:04 ` Takashi Sakamoto
@ 2020-10-07 15:23 ` Takashi Sakamoto
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2020-10-07 15:23 UTC (permalink / raw)
To: Dan Carpenter, Clemens Ladisch, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, kernel-janitors
Oops, I forgot to add my tag to the former message.
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
On Wed, Oct 07, 2020 at 10:04:37PM +0900, Takashi Sakamoto wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: bebob: potential info leak in hwdep_read()
2020-10-07 7:49 [PATCH] ALSA: bebob: potential info leak in hwdep_read() Dan Carpenter
2020-10-07 13:04 ` Takashi Sakamoto
@ 2020-10-07 15:34 ` Takashi Iwai
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-10-07 15:34 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel, Clemens Ladisch, kernel-janitors, Takashi Iwai
On Wed, 07 Oct 2020 09:49:28 +0200,
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>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-07 15:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 7:49 [PATCH] ALSA: bebob: potential info leak in hwdep_read() Dan Carpenter
2020-10-07 13:04 ` Takashi Sakamoto
2020-10-07 15:23 ` Takashi Sakamoto
2020-10-07 15:34 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).