diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-09-13 03:44:44 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-09-13 08:31:51 -0400 |
commit | 0c21fccd97f0ff58e6e9699370a09f6ec8946061 (patch) | |
tree | 75f54f5361d4869e817a6cca38a62c9e73256d0b /sound/pci/asihpi | |
parent | 3d0049e8529adaa36c38a7b400792f6c37b66c92 (diff) |
ALSA: asihpi: a couple array out of bounds issues
These ->put() functions are called from snd_ctl_elem_write() with user
supplied data. snd_asihpi_tuner_band_put() is missing a limit check and
the check in snd_asihpi_clksrc_put() can underflow.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi')
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index dc632cdc3870..5f2acd35dcb9 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -1913,6 +1913,7 @@ static int snd_asihpi_tuner_band_put(struct snd_kcontrol *kcontrol, | |||
1913 | struct snd_card_asihpi *asihpi = snd_kcontrol_chip(kcontrol); | 1913 | struct snd_card_asihpi *asihpi = snd_kcontrol_chip(kcontrol); |
1914 | */ | 1914 | */ |
1915 | u32 h_control = kcontrol->private_value; | 1915 | u32 h_control = kcontrol->private_value; |
1916 | unsigned int idx; | ||
1916 | u16 band; | 1917 | u16 band; |
1917 | u16 tuner_bands[HPI_TUNER_BAND_LAST]; | 1918 | u16 tuner_bands[HPI_TUNER_BAND_LAST]; |
1918 | u32 num_bands = 0; | 1919 | u32 num_bands = 0; |
@@ -1920,7 +1921,10 @@ static int snd_asihpi_tuner_band_put(struct snd_kcontrol *kcontrol, | |||
1920 | num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands, | 1921 | num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands, |
1921 | HPI_TUNER_BAND_LAST); | 1922 | HPI_TUNER_BAND_LAST); |
1922 | 1923 | ||
1923 | band = tuner_bands[ucontrol->value.enumerated.item[0]]; | 1924 | idx = ucontrol->value.enumerated.item[0]; |
1925 | if (idx >= ARRAY_SIZE(tuner_bands)) | ||
1926 | idx = ARRAY_SIZE(tuner_bands) - 1; | ||
1927 | band = tuner_bands[idx]; | ||
1924 | hpi_handle_error(hpi_tuner_set_band(h_control, band)); | 1928 | hpi_handle_error(hpi_tuner_set_band(h_control, band)); |
1925 | 1929 | ||
1926 | return 1; | 1930 | return 1; |
@@ -2383,7 +2387,8 @@ static int snd_asihpi_clksrc_put(struct snd_kcontrol *kcontrol, | |||
2383 | struct snd_card_asihpi *asihpi = | 2387 | struct snd_card_asihpi *asihpi = |
2384 | (struct snd_card_asihpi *)(kcontrol->private_data); | 2388 | (struct snd_card_asihpi *)(kcontrol->private_data); |
2385 | struct clk_cache *clkcache = &asihpi->cc; | 2389 | struct clk_cache *clkcache = &asihpi->cc; |
2386 | int change, item; | 2390 | unsigned int item; |
2391 | int change; | ||
2387 | u32 h_control = kcontrol->private_value; | 2392 | u32 h_control = kcontrol->private_value; |
2388 | 2393 | ||
2389 | change = 1; | 2394 | change = 1; |