浏览代码

ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl

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>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Dan Rosenberg 14 年之前
父节点
当前提交
4a122c10fb
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      sound/pci/asihpi/hpioctl.c

+ 5 - 0
sound/pci/asihpi/hpioctl.c

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