[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87o7hcw2dq.wl-tiwai@suse.de>
Date: Fri, 06 Oct 2023 11:01:37 +0200
From: Takashi Iwai <tiwai@...e.de>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Torsten Schenk <torsten.schenk@...o.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] ALSA: 6fire: Fix undefined behavior bug in struct midi_runtime
On Fri, 29 Sep 2023 18:06:32 +0200,
Gustavo A. R. Silva wrote:
>
> `struct urb` is a flexible structure, which means that it contains a
> flexible-array member at the bottom. This could potentially lead to an
> overwrite of the objects following `out_urb` in `struct midi_runtime`,
> among them a function pointer.
>
> Fix this by placing the declaration of object `out_urb` at the end of
> `struct midi_runtime`.
>
> Fixes: c6d43ba816d1 ("ALSA: usb/6fire - Driver for TerraTec DMX 6Fire USB")
> Cc: stable@...r.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
The same question as your another 6fire patch is applied here: does it
"fix" anything real?
thanks,
Takashi
> ---
> sound/usb/6fire/midi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/usb/6fire/midi.h b/sound/usb/6fire/midi.h
> index 47640c845903..df3f41913274 100644
> --- a/sound/usb/6fire/midi.h
> +++ b/sound/usb/6fire/midi.h
> @@ -22,12 +22,12 @@ struct midi_runtime {
> spinlock_t in_lock;
> spinlock_t out_lock;
> struct snd_rawmidi_substream *out;
> - struct urb out_urb;
> u8 out_serial; /* serial number of out packet */
> u8 *out_buffer;
> int buffer_offset;
>
> void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
> + struct urb out_urb;
> };
>
> int usb6fire_midi_init(struct sfire_chip *chip);
> --
> 2.34.1
>
Powered by blists - more mailing lists