Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp4037342rdh; Fri, 29 Sep 2023 09:15:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUK9SkCRyr+m3LfJIoX7Ka93lUb7Mun0NmNbh91bfQHKftlU0ltXah10sQRwq5Oa5yfadH X-Received: by 2002:a05:6808:1818:b0:3a7:5b1d:9470 with SMTP id bh24-20020a056808181800b003a75b1d9470mr5885600oib.53.1696004110094; Fri, 29 Sep 2023 09:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696004110; cv=none; d=google.com; s=arc-20160816; b=HGIgmANn/HZaFv1ucAXH8AL+5MwlDvFQl3LRRQnPw094yXDi0OQXTF/KC2OPIa9nAC HXthhv4wIWs/nPFv/FJbS0r1x3aoZ8p6bmy+ZbRFHWvbwJ8VgpEumcchZVZsLAnmwSVq HkzB98MHIr+8vfC3JBy121ju8nqeivsuT46lCPpNB3tNdK75wMeW6ZA/C/VDQGLbelGh /dViOKRifGctiNwXv58t91GDR7AZDTqmmsKNHW9+aeRlP0SKfmzS/53S0O6xqh7Hm4jg 0CDnAKxrvF0/Y7SD/+LssqsDCYO16oadf7TZV2hg/VB7vDhjpwnmwD89I2DBfj6SuviN mgTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=1kdJIKmc7Ck1RWQ7dFtgDfFvcEG3MaZmQEDNFwVdF6A=; fh=JM+07Ch9NtN8RPXCZq0qDGvXOetvejo3RDEW87XSfsM=; b=jadDmFDh37J46ymK34Oc+AM8h+znc5W1+mQ0O7ZsdAOnGKKK1UCV2DKJklSsIyOj2c 7FD379E0fr6sOzhvOiIYHR/p0S60xUUTwqbfXFi7lQ8V9IFArK+8aTpysUM6URxlMlox ojXrq6+IvszJCXo1NIsmpnnzjLqKbcup8zur+tY57BjfRtcgumX0stPFzoMWPRA6+B5Q wF2H3+4MS21Mr6B97+5u43CZrbb+ySy2dr0WdIX7Z/28vGbg7uxD4yxplFDRTF8Y0m55 t01HJGYvvAicHwneACKXdg1D4E4KYIOJKuaWeKCR5yJaXkeWjVq8QoVpKCSHUjUyZakn PcLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e30T/zR3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u128-20020a637986000000b005774cf04028si2412320pgc.764.2023.09.29.09.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 09:15:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e30T/zR3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A5CAD8093D6A; Fri, 29 Sep 2023 09:07:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233721AbjI2QGm (ORCPT + 99 others); Fri, 29 Sep 2023 12:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233551AbjI2QGk (ORCPT ); Fri, 29 Sep 2023 12:06:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70DE139 for ; Fri, 29 Sep 2023 09:06:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34E10C433C7; Fri, 29 Sep 2023 16:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696003598; bh=JjvdY6vNRaU1rCbwGgkNSNDb81US03BKyTCcV+LEmPM=; h=Date:From:To:Cc:Subject:From; b=e30T/zR3Px8FY8bLmSHYEjXs067XxvqClj1EJBQHwpfJQBDSKfIUYiDAqJnrACHgL ar2NOy1poMvsQsZFHuAP7WtSeEHsX1xrHfkABQgjApuw4IpBPZyaUOTdDN4b+W0tOa FVR6oL2W9qAep9+fTN8nOD93r6n8TA6P64JmUr6q1OFetkZhEjMrY2EySQdES1wcv/ 0ewYZ3u+FKNvtFxeFG6CFSmTpsFC4sqqDryE2lr2DgH15NNcOr33pnHti682imoHjc c9KoRsJHI0PxhF6iVdprbM1byqep7GcCeCqlXiwx2nFjlZGKDlt04FTospMVv4hjG6 bdv/SgZsrBSGA== Date: Fri, 29 Sep 2023 18:06:32 +0200 From: "Gustavo A. R. Silva" To: Jaroslav Kysela , Takashi Iwai , Torsten Schenk Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] ALSA: 6fire: Fix undefined behavior bug in struct midi_runtime Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 09:07:09 -0700 (PDT) `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 --- 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