dect
/
linux-2.6
Archived
13
0
Fork 0

staging: speakup: avoid out-of-range access in synth_add()

Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: stable <stable@vger.kernel.org>
Cc: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Samuel Thibault 2013-01-07 22:03:51 +01:00 committed by Greg Kroah-Hartman
parent ae428655b8
commit 6102c48bd4
1 changed files with 1 additions and 1 deletions

View File

@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth)
int i;
int status = 0;
mutex_lock(&spk_mutex);
for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++)
for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
/* synth_remove() is responsible for rotating the array down */
if (in_synth == synths[i]) {
mutex_unlock(&spk_mutex);