From: Dan Rosenberg Date: Thu, 17 Mar 2011 22:32:24 +0000 (-0400) Subject: ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl X-Git-Tag: v3.0~1142^2~23^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a122c10fbfe9020df469f0f669da129c5757671;p=platform%2Fkernel%2Flinux-amlogic.git 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 Cc: Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 26186be..cd624f1 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -156,6 +156,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 = res_max_size; if (hm->h.object == HPI_OBJ_SUBSYSTEM) {