Re: [patch] Fix snd-usb-audio in 32-bit compat environemt

From: Juergen Kreileder
Date: Sun Feb 19 2006 - 13:59:59 EST


Alexey Dobriyan <adobriyan@xxxxxxxxx> writes:

> On Sat, Feb 18, 2006 at 07:50:37PM +0100, Juergen Kreileder wrote:
>> 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.)
>
> IMO, what you did is an overkill.

The advantage of the longer fix is reduced stack usage.

> Does this patch fixes your problem?

Yes but you can have that even simpler:

--- linux-mm-vanilla/sound/core/control_compat.c 2006-02-18 17:00:17.000000000 +0100
+++ linux-mm/sound/core/control_compat.c 2006-02-19 19:41:51.000000000 +0100
@@ -167,7 +167,7 @@ static int get_ctl_type(struct snd_card
int *countp)
{
struct snd_kcontrol *kctl;
- struct snd_ctl_elem_info info;
+ struct snd_ctl_elem_info info = {0};
int err;

down_read(&card->controls_rwsem);
=


Juergen

--
Juergen Kreileder, Blackdown Java-Linux Team
http://blog.blackdown.de/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/