From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8243DE92FF9 for ; Fri, 6 Oct 2023 09:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbjJFJBm (ORCPT ); Fri, 6 Oct 2023 05:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjJFJBk (ORCPT ); Fri, 6 Oct 2023 05:01:40 -0400 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 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >