From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E415D11184 for ; Fri, 6 Oct 2023 09:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="kChFPxns"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="trSMZbzQ" Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACF383; Fri, 6 Oct 2023 02:01:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 338811F45F; Fri, 6 Oct 2023 09:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1696582898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oZDIguXnYNfuvCTy25QRJxOzQExo+GhNuL1tdAJxFvA=; b=kChFPxnscyTax/udKiuFDpBaYJYhTPJwooQqM/Cv6yVz1xL/CwqE4CtdXl1xEtAEzeFdWc fbZqCX8X/p754Nq/mQHpbbIiJgsUoUV9Kch7KssOTSXdDmSMTYKcjN6fdyPtCwApnE9iei sUJ+uFAwwjJx7DnO58A3tRw8G3gGPaM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1696582898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oZDIguXnYNfuvCTy25QRJxOzQExo+GhNuL1tdAJxFvA=; b=trSMZbzQbey/vL5X3ZMqvPQ1c0mqQpwWLuwPSYWJ0DzqLHg44qo+pb4m0iBjKgrWk0N7vD MacWe9eXesnBqfAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 03BD613A2E; Fri, 6 Oct 2023 09:01:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rRVXO/HMH2VDKQAAMHmgww (envelope-from ); Fri, 06 Oct 2023 09:01:37 +0000 Date: Fri, 06 Oct 2023 11:01:37 +0200 Message-ID: <87o7hcw2dq.wl-tiwai@suse.de> From: Takashi Iwai To: "Gustavo A. R. Silva" Cc: Jaroslav Kysela , Takashi Iwai , Torsten Schenk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] ALSA: 6fire: Fix undefined behavior bug in struct midi_runtime In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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@vger.kernel.org > Signed-off-by: Gustavo A. R. Silva 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 >