Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp4021870rdh; Fri, 29 Sep 2023 08:59:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW63RU2Ub1HPdX5WJqDcl8zdBYTm6S3iuBLxsahKoduh85BRqoFVoCLWhnnM74G3PZOuHG X-Received: by 2002:a05:6a20:3d87:b0:13f:b028:789c with SMTP id s7-20020a056a203d8700b0013fb028789cmr4946403pzi.5.1696003181844; Fri, 29 Sep 2023 08:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696003181; cv=none; d=google.com; s=arc-20160816; b=wSvtOuwu+qNdo9aMvUo7brx9alpS41lZxKKMQPOEiHUurR4TMmDTTjvAFChnl1X+uE AOSqIMQs3B757goQ9KXIHn1zIRQl1CSE5zH0DtcKBXwNXlxf+wa37YfsRdhm0XpjimlZ mjlicztz0LDFsX3C38lsBi9GbyFkdNe8ZtOLWPAxSJgo5ROuo81BDLLhz5ftkEPn1ldk q0wqacwJD+m4BcdBEbZzVdYZmh6PqYfodIJBVQrHG1K3wuHuqvmxIcQqLYPy12HlFmk8 tNYygJTTmHpL19kpc1dMl4bhpapic2FTUs+JcVlh1vJHfIciPGQeoJeV8jvOFhp+I2sq Aarw== 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=0ttJTwKN130+tmHo29VT2VrWZht6be55rIjfXfE96vA=; fh=mSzG5hg4bwmmmuflZ4+7bzKFkfPIridSyVHkXiuikO4=; b=j5XCRtqAtDgl7CJsWs3rxvzRHd5Gy4gF8MCR0Rx05xZEG594SVyPNfY/uJBdbhZvuc nFHus/2wp0wlZXBRsRddCXg1skYfeIQoR476HS0gOkPFgNq+hZQ+yW3zY5DXIhyguV8G jlRTeiQAJCQ0487c7WnEiHvJKRlfa74zGcrpcA33Z5NJOxj9az+215fUWVsknZhZ3sXx Nyv98lHqnnInNfDLUsrBBact+Cm/ZVBbg11ijtoXx/WY9UcIOyyTc6fIAIxbVxHaLdA9 iYb7iNeLGmynGO7Ll0feLq4u7U3gl5oHUQj04AtqA2dLQMzPnc7fajlIie3UGXR+TyL6 zwSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ji33FVLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g123-20020a636b81000000b005775a4a2960si21345303pgc.261.2023.09.29.08.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 08:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ji33FVLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id A50CC82A7E33; Fri, 29 Sep 2023 08:59:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233646AbjI2P7c (ORCPT + 99 others); Fri, 29 Sep 2023 11:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233141AbjI2P7b (ORCPT ); Fri, 29 Sep 2023 11:59:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8BBE139 for ; Fri, 29 Sep 2023 08:59:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF5B3C433C8; Fri, 29 Sep 2023 15:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696003169; bh=MnZquLPkDBkjKHQwlCsmfD9plASD37pKQYphc5bm4a0=; h=Date:From:To:Cc:Subject:From; b=Ji33FVLvtjef5TpdrXCXT+tOfwK7X6QqaDW/sSTW4uncDJ0ZD9QBIZRmOUQKsgWmN QAMCATmVFijx8Ajh0KRMVLs4/Ie2iez01r2ZQyzhpaJR+MveEuei8hv1I1+AA1xmW3 4PH/aAAdF0p2YDAtLRE8dOPiriMcOvZcelN0alOaurtwQY6DGn94/ko5B/BINekQ74 IfRn7eWnesujGiT4JQEJYxfMUmcCRe8TLku3hCbeiZvI/IFBpvXE7FdC6PNebn/cwN eOpJTyQLqnuKMSDxcxYEvvGb6KYot/hn7gOtIDSNOP8ZDBbsQUVchp6GoohIeN39cX QDXFd3aOUztUg== Date: Fri, 29 Sep 2023 17:59:22 +0200 From: "Gustavo A. R. Silva" To: Jaroslav Kysela , Takashi Iwai , Jussi Kivilinna 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 comm_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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 29 Sep 2023 08:59:38 -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 `receiver` in `struct comm_runtime`, among them some function pointers. Fix this by placing the declaration of object `receiver` at the end of `struct comm_runtime`. Fixes: ddb6b5a96437 ("ALSA: 6fire: fix DMA issues with URB transfer_buffer usage") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva --- sound/usb/6fire/comm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h index 2447d7ecf179..ee81572a4eec 100644 --- a/sound/usb/6fire/comm.h +++ b/sound/usb/6fire/comm.h @@ -19,7 +19,6 @@ enum /* settings for comm */ struct comm_runtime { struct sfire_chip *chip; - struct urb receiver; u8 *receiver_buffer; u8 serial; /* urb serial */ @@ -30,6 +29,7 @@ struct comm_runtime { int (*write8)(struct comm_runtime *rt, u8 request, u8 reg, u8 value); int (*write16)(struct comm_runtime *rt, u8 request, u8 reg, u8 vh, u8 vl); + struct urb receiver; }; int usb6fire_comm_init(struct sfire_chip *chip); -- 2.34.1