Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp446549lqh; Fri, 31 May 2024 06:25:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4LiJ6B02Yz1NsSgH+ivDQsjCChYPxaIuj0Mgb/3ZKQMMgbfBwArLjrfgt4xaIR/GpNDPpnKC8Yz/+W83tAty0kCO9giPTHx88F5Lorw== X-Google-Smtp-Source: AGHT+IEk1oXELRLf/XFY7egXM7i9KOBz/RkzMpE+OMEPQTMvXRbm5j+zGeN8afdr7BMSWK51OzTL X-Received: by 2002:a17:902:e88f:b0:1f3:244:c619 with SMTP id d9443c01a7336-1f636fdba8fmr19104805ad.7.1717161932956; Fri, 31 May 2024 06:25:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717161932; cv=pass; d=google.com; s=arc-20160816; b=OmmhFnONwChAav1Do8gNmZQe7ePFpq/qWJaYGbz7Im/3bMTaWMI/zzNx2te7g6ggsc f+ORFneSjhK4kbMMwpa0jWntKspK6DPJWowvgmZtvum9CuyoBV39KrJHNrlxld1pc3z6 Q3xOghfn1ebMGxqTE6KiT81VGImzxdkL3p6pM92VSHqkrqwZUFqSemJngjYwlqTerFP1 AeSfLNDc94mdo6gU8BC5fOUCxNgqe1OxQwP3gH9QhN01CYBfikUJcUc4akd41/EzJFSW +5Vm8fhDJRsMUpmGOGtAlVRRjqXF66K74RNEZ+nCzCHqIWdXGymsEVrWQL03YJGjJhTC NeMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5JeMxkTrFF8vSSiZ6PRcWRKQjzUi7rOLypddoJfxbfc=; fh=4j2nDpzwpHI8lSisXzsdKbd/aFMo1rfd3OIrIbhRdLM=; b=NdG8Upw/6FUisaucfvNYO1TT7MDurPrZncEgsZdF8SviqoM6lRikLGGTLvyFhpJ1TD UZAwWK9m2Zb8kXBdbcMqD73gWqJGieyFVrw9NCkj0pKXfYrJefFvmC1RJNI9NNwam3C9 SeHX3KJbseifL+IxZ+IWB8FJ8Qqaf+G7OzjGqvULIpdtcIgcm88R9ebs72Jx8V2cPeIp O1+VthCkC3gjyHHmF4POgpof3OMj76FYhtlAW05DhBJiRq1oCI+IXkalR1UpbULZZjca 4AElRRr7DdDm1r6HjXJKaf2rXThtvn3F+Cqq04X/NoRsf9/xImmWNQilQESfzq5TkEfh Ppgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DC20ebcs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-8344-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323feb33si16191135ad.444.2024.05.31.06.25.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8344-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DC20ebcs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-8344-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3CB7728BD73 for ; Fri, 31 May 2024 13:24:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 062CF158D60; Fri, 31 May 2024 13:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DC20ebcs" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C796F158204; Fri, 31 May 2024 13:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717161875; cv=none; b=aWIuG6hhYgHWGM+hr4hl/n16Ts9uQZjEM7Fx/n3YNO2aqqAyiCQzU9TV9qAHYpkwb1sEtqm2eSkoLKC1q/GH5jdTbnBPnt1LkkV6/uAuUvXwPQhozB17sHUuUrDWR2EdLRBkyd3xLvQYfpg/qtqKmgnw7aK0Mw6sxyT9BfxBCbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717161875; c=relaxed/simple; bh=qC6oQjpZSfBA998RP9I1hRl7y4IrnDxjeMykj7MUTFY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H/hTNVA2JOITo+sg0Oiepi8UGbkgBkAdMI4j5WwugoG6zzNDHEle8XE/idFi69SHkTkY/gHV1uymxBfl+v1AuSAj3RmYxpU8ZJPtnFoTWkoDOtXAfvcGMHdKOZiKfYZnzm6t73k1uGlPQsfbRHsa1vuvn1Wwha5DaSqr+AybYjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DC20ebcs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A8FC116B1; Fri, 31 May 2024 13:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717161875; bh=qC6oQjpZSfBA998RP9I1hRl7y4IrnDxjeMykj7MUTFY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DC20ebcsFvKurvoX/FWth/aEYtFBnTLnMFW1FbIVl2GUL8Qkq3gaqnu+lMF9G/jyp ZWRaGdR0+5ZJWdvGp9DP11ZiPdAkNBihvRk68H8XJtRosaPWA2KuaFh3V1iE267umX U5DWkcItpa79VzUcndKXdBqVcwRjSo4tbLAvmIf+f/p37igTPHr0q/45yER2Gr561/ /f8DyZzJHIEZNIs6FdAz3f5dJk2RGbgnOaZ4ShPyD2GZfoGJWWsMkG6wgadKRpTcC2 22CRV7G+TsKkUTMtYSmHh2m21BnYgJCSSq9aYjebtp+1aHtsosGDi7+rQrEmPBYpGP dXZqYDloSDWdg== Date: Fri, 31 May 2024 14:24:31 +0100 From: Simon Horman To: Johannes Berg Cc: Kenton Groombridge , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Kees Cook Subject: Re: [PATCH v2] wifi: mac80211: Avoid address calculations via out of bounds array indexing Message-ID: <20240531132431.GH123401@kernel.org> References: <20240517145420.8891-1-concord@gentoo.org> <20240517204532.GC475595@kernel.org> <9fca4c0d496eb731f571cd8eacd409b9a9e61dae.camel@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9fca4c0d496eb731f571cd8eacd409b9a9e61dae.camel@sipsolutions.net> On Thu, May 23, 2024 at 11:35:37AM +0200, Johannes Berg wrote: > On Fri, 2024-05-17 at 21:45 +0100, Simon Horman wrote: > > > > FWWIW, it seems unfortunate to me that the __counted_by field (n_channels) > > is set some distance away from the allocation of the flex-array (channels) > > whose bounds it checks. It seems it would be pretty easy for a bug in the > > code being updated here to result in an overrun. > > > > In a way, this is a more general problem, this allocates the max we know > we might need, but then filter it down. It'd have to iterate twice to > actually allocate the "correct" size, but then you could still have bugs > by having different filter conditions in the two loops ... Yes, I agree this problem is more general than this patch or the code it updates. > Don't see any good solutions to this kind of code? I was hoping you might :)