Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp517381pxh; Tue, 9 Nov 2021 14:33:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxukFYA6TJg+9z/fx1L+nvm9RQv8u5iambnPsG8rc6IfojJRBruflSt+YqNd9jPRtkmJZt1 X-Received: by 2002:a05:6e02:1bcb:: with SMTP id x11mr7437293ilv.94.1636497206796; Tue, 09 Nov 2021 14:33:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636497206; cv=none; d=google.com; s=arc-20160816; b=nijOE8OnxxxolXiamZ277biAgTBeMFn9tpcwgIfe+ReF01Qi8plqu32rn9JZGva0mF hQRlbhX5KT2dyR+aSdzo/vWoTt4M6uHLPx54Zrf583wFjaEZeZjbPfb0GwBaUm2ab22s F3h8kqNalbZFtHnRYV60WKcXMGkWK29cFZm70tz4hq2WtqdqJhcj9EuiJ+VmEXD257qq AP+UDUdLRljIlsLXBUy7C+YOzc+rlFRLxHc6rkYiDWbG6ANMl6FQCjs1yRpS/FjNP2wP TQvx4UXHGOulSGq0jzOk447mh+WNE0lkWlDUcDYLNxmhysor4r/SkENlg77/PXIVuiht nZNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tzUBCRI0ZEiUTjI4kQ5UxbfpHunrGMBYtyyXAY2lvGg=; b=jX1ZTU54HWcnIN3vqlO2CA7I/MwbN/ph3KX2pRMVeCFqelpWjN3nhkwT6uAO5tObkv ldcFXP0RBiq+bCNX2ZjTfSQ97RMsQtm89bZBTFNvtYxwf5pZRH5RxW2fPiaoY8mTkUrZ //3z/gNbIA/zN3KK2XD0fOJFErPvYIWFY6X6kZUrUieL0BkVzHKa4Zt/Z7Fjd9n3IdEI 4hOz3gEBf5mLwAJgmC8JHxsSgwKYhxM45nATdyHgDKaejskTKooviDn0CBMdCfF1T9Dx SgwfqvI/1pFkljWyYCStmBCQwnxYCGxBd0FGUvT7CmTOCXKiNMOjyJkxj+H7fm1ykaCj WTew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oQhkxKUY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si28933039iot.96.2021.11.09.14.32.39; Tue, 09 Nov 2021 14:33:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oQhkxKUY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbhKIQQY (ORCPT + 68 others); Tue, 9 Nov 2021 11:16:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238523AbhKIQQX (ORCPT ); Tue, 9 Nov 2021 11:16:23 -0500 Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BDE3C061764; Tue, 9 Nov 2021 08:13:37 -0800 (PST) Received: by mail-ua1-x92b.google.com with SMTP id p2so550747uad.11; Tue, 09 Nov 2021 08:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tzUBCRI0ZEiUTjI4kQ5UxbfpHunrGMBYtyyXAY2lvGg=; b=oQhkxKUY2gj5xInLINgKaVx+p/wLVFabBC7fYFCIDQx0W6JIYXvo0jwaHBTa8RYCNC dI6AAummztsVAF4+SqaSi0Z6lLliTs/1h9SRyn8Ac3OgKkKfl571n67ZfFPvBqDfJkEM uLZ2kp632JLI7bZIBgo514Hj14HaZL2r63V6zpsiStjuIGYcWrs9YigDprMwlPcrwH7s mWl5RrJTA49BA8UYwG2TJ6KNE3rC5Cn/AKm+WzVuUv6fEtus64XtW9q3q2R9W91CIF+b /gPgH/FS7BPA9hwCuKr88ZrMt7kGoLD0rWVWlLdhPf7xtFcbaoEbYnijSqhQVIdtNaq2 pGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tzUBCRI0ZEiUTjI4kQ5UxbfpHunrGMBYtyyXAY2lvGg=; b=DZsE+xZXzCY1FAxltv6+hp1JJKXymeZkLxRXTLPmpGnoblD4/KxpPweL/Lr92MF991 JloPp35IzC25koe5EkwCMC21HScb/NUNTG86QrDTX4HiAlnBotI2W7gtoeWCpA1sxKwu MdoudCnqczFdx/kZ15Y/0/jThOQZumdz0sZMQ8nJ4w6sE5xHrRJawmBCHC9w9WAsw0ns 1eqzDHUeUNEfvqPOxUBXsDlZKrWIZm/fqzriBnwfOEznAcESS7SYVgrKpxYt8hoq+cut atIlfYHagNIhVuix0BDtDNHCoSWTp58LG1HBfhn7tglXJL0cOIt8+nkRzSBUeQSBlpJI qmRA== X-Gm-Message-State: AOAM531WG1LiYC2xfafEoVLDZrpHoI2OjBflppoo8WZGu4SA3fluMay7 ZPgZxe70L++NdFcXMdsc/JNB1hdLKBKbjqWZRudtl8q7 X-Received: by 2002:ab0:3898:: with SMTP id z24mr11672656uav.26.1636474416650; Tue, 09 Nov 2021 08:13:36 -0800 (PST) MIME-Version: 1.0 References: <20211109100203.c61007433ed6.I1dade57aba7de9c4f48d68249adbae62636fd98c@changeid> In-Reply-To: <20211109100203.c61007433ed6.I1dade57aba7de9c4f48d68249adbae62636fd98c@changeid> From: Sid Hayn Date: Tue, 9 Nov 2021 11:13:26 -0500 Message-ID: Subject: Re: [PATCH] mac80211: fix radiotap header generation To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Kees Cook , Johannes Berg , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Please add my tested-by as well. I tested with and without this patch on multiple chipsets and everything appears functional now. Thanks for the quick fix! Tested-by: Sid Hayn On Tue, Nov 9, 2021 at 4:02 AM Johannes Berg wrote: > > From: Johannes Berg > > In commit 8c89f7b3d3f2 ("mac80211: Use flex-array for radiotap header > bitmap") we accidentally pointed the position to the wrong place, so > we overwrite a present bitmap, and thus cause all kinds of trouble. > > To see the issue, note that the previous code read: > > pos = (void *)(it_present + 1); > > The requirement now is that we need to calculate pos via it_optional, > to not trigger the compiler hardening checks, as: > > pos = (void *)&rthdr->it_optional[...]; > > Rewriting the original expression, we get (obviously, since that just > adds "+ x - x" terms): > > pos = (void *)(it_present + 1 + rthdr->it_optional - rthdr->it_optional) > > and moving the "+ rthdr->it_optional" outside to be used as an array: > > pos = (void *)&rthdr->it_optional[it_present + 1 - rthdr->it_optional]; > > The original is off by one, fix it. > > Cc: stable@vger.kernel.org > Fixes: 8c89f7b3d3f2 ("mac80211: Use flex-array for radiotap header bitmap") > Reported-by: Sid Hayn > Signed-off-by: Johannes Berg > --- > net/mac80211/rx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c > index fc5c608d02e2..3562730ea0f8 100644 > --- a/net/mac80211/rx.c > +++ b/net/mac80211/rx.c > @@ -364,7 +364,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, > * the compiler to think we have walked past the end of the > * struct member. > */ > - pos = (void *)&rthdr->it_optional[it_present - rthdr->it_optional]; > + pos = (void *)&rthdr->it_optional[it_present + 1 - rthdr->it_optional]; > > /* the order of the following fields is important */ > > -- > 2.31.1 >