ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl
authorDan Rosenberg <drosenberg@vsecurity.com>
Thu, 17 Mar 2011 22:32:24 +0000 (18:32 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 20:03:59 +0000 (13:03 -0700)
commit 4a122c10fbfe9020df469f0f669da129c5757671 upstream.

The user-supplied index into the adapters array needs to be checked, or
an out-of-bounds kernel pointer could be accessed and used, leading to
potentially exploitable memory corruption.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

sound/pci/asihpi/hpioctl.c

index 22dbd91..448dd01 100644 (file)
@@ -155,6 +155,11 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                goto out;
        }
 
+       if (hm->h.adapter_index >= HPI_MAX_ADAPTERS) {
+               err = -EINVAL;
+               goto out;
+       }
+
        pa = &adapters[hm->h.adapter_index];
        hr->h.size = 0;
        if (hm->h.object == HPI_OBJ_SUBSYSTEM) {