ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl
[linux-flexiantxendom0-natty.git] / 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) {