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 BD332E728CC for ; Fri, 29 Sep 2023 17:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233406AbjI2R1r (ORCPT ); Fri, 29 Sep 2023 13:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233450AbjI2R1f (ORCPT ); Fri, 29 Sep 2023 13:27:35 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3EA1BFD for ; Fri, 29 Sep 2023 10:26:36 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c752caeaa6so103245ad.1 for ; Fri, 29 Sep 2023 10:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696008396; x=1696613196; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SgWJstEGJd48Eg1HdzFdOilLMPMqmWhwLsi9bYeQl7s=; b=R11ri71zTmA5emJGU5mz5LjwNMZA1cCORaTtco5nfVll1TcZLsagRgajqn5QjUsLdL bO/I3H/6VJpyCkesYCHixGyzmUnW8GtEREaPiLSeh26totC5vRaBm74rQviNDNsuVMYD PEd8RePwhMCbAyOVm36MobRdHCt+WR3Dr2aJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696008396; x=1696613196; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SgWJstEGJd48Eg1HdzFdOilLMPMqmWhwLsi9bYeQl7s=; b=ZtI757WJGhsndTH1MIcQEpciu3XjBLAEZWjjtES6fuycbjkaIMFIEilE+WtDgKiGCi 5yUbtFT1KegjGx5agK8vQTkA/+u/8y4ROyHWjcEsGUcRBGbq67atXA4BfQgP1Smie+Sf MQx0kLxHae46te5EBoDz7Vyb5MPAakhdvEVRbn/qFOr7g6/GN+1OlWzn92eAXKeetds+ CthIhASvCAC3+VPDeVfpYhnJSoohT6M+6Zz1I/UrnuuFY2Boeo3t0tTkY6V9nEKeHU4c 8tJ+TD/0RqHRI5v73v2rSgw2xYvsg7FGZvrFRoE/xzKdzQrJaxCDkXkvAXwtCYWB/Ntt FlVQ== X-Gm-Message-State: AOJu0YwbTw4vgaVx0c8EvpO03ChnCVVoRxyrcRSIu9v7u2Ij/i7UHYCV QXwiCqV89d5xZUWDfw4MWASodQ== X-Google-Smtp-Source: AGHT+IG3mCcEa8WVJpFPvOj0b5dGwRnh2/1kFQNVIYL87dKwC/DqhQALhB/xIzmN0rioBZhmbty5Cw== X-Received: by 2002:a17:90a:bd8d:b0:268:e5db:6e19 with SMTP id z13-20020a17090abd8d00b00268e5db6e19mr4483958pjr.20.1696008396220; Fri, 29 Sep 2023 10:26:36 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id oj3-20020a17090b4d8300b00276fc32c0dasm1701460pjb.4.2023.09.29.10.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 10:26:35 -0700 (PDT) Date: Fri, 29 Sep 2023 10:26:35 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Jaroslav Kysela , Takashi Iwai , Jussi Kivilinna , 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 comm_runtime Message-ID: <202309291024.14F6DA0@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 29, 2023 at 05:59:22PM +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 `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 Should these mention -Wflex-array-member-not-at-end ? Reviewed-by: Kees Cook -- Kees Cook