diff options
author | Juergen Kreileder <jk@blackdown.de> | 2006-02-20 21:28:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-20 23:00:10 -0500 |
commit | aa657ca9245a06fa435e00332a13da1fce182abc (patch) | |
tree | 51e89251d12cd496cb502920467b8fa9a47b47b0 /sound | |
parent | a9c930bac163c5e616ca0ba9378e7dc746c93227 (diff) |
[PATCH] Fix snd-usb-audio in 32-bit compat environment
I'm getting oopses with snd-usb-audio in 32-bit compat environments:
control_compat.c:get_ctl_type() doesn't initialize 'info', so
'itemlist[uinfo->value.enumerated.item]' in
usbmixer.c:mixer_ctl_selector_info() might access random memory (The 'if
((int)uinfo->value.enumerated.item >= cval->max)' doesn't fix all problems
because of the unsigned -> signed conversion.)
Signed-off-by: Juergen Kreileder <jk@blackdown.de>
Cc: Jaroslav Kysela <perex@suse.cz>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Greg KH <greg@kroah.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/control_compat.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 418c6d4e5daf..a529b62972b4 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -167,7 +167,7 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, | |||
167 | int *countp) | 167 | int *countp) |
168 | { | 168 | { |
169 | struct snd_kcontrol *kctl; | 169 | struct snd_kcontrol *kctl; |
170 | struct snd_ctl_elem_info info; | 170 | struct snd_ctl_elem_info *info; |
171 | int err; | 171 | int err; |
172 | 172 | ||
173 | down_read(&card->controls_rwsem); | 173 | down_read(&card->controls_rwsem); |
@@ -176,13 +176,19 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, | |||
176 | up_read(&card->controls_rwsem); | 176 | up_read(&card->controls_rwsem); |
177 | return -ENXIO; | 177 | return -ENXIO; |
178 | } | 178 | } |
179 | info.id = *id; | 179 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
180 | err = kctl->info(kctl, &info); | 180 | if (info == NULL) { |
181 | up_read(&card->controls_rwsem); | ||
182 | return -ENOMEM; | ||
183 | } | ||
184 | info->id = *id; | ||
185 | err = kctl->info(kctl, info); | ||
181 | up_read(&card->controls_rwsem); | 186 | up_read(&card->controls_rwsem); |
182 | if (err >= 0) { | 187 | if (err >= 0) { |
183 | err = info.type; | 188 | err = info->type; |
184 | *countp = info.count; | 189 | *countp = info->count; |
185 | } | 190 | } |
191 | kfree(info); | ||
186 | return err; | 192 | return err; |
187 | } | 193 | } |
188 | 194 | ||