Skip to content

Commit

Permalink
ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
Dan Rosenberg authored and tiwai committed Mar 18, 2011
1 parent 98d21df commit 4a122c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/pci/asihpi/hpioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4a122c1

Please sign in to comment.