Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3634250imu; Mon, 28 Jan 2019 08:10:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN7UT9Ee6DB5R5NJgJvGRxlfre9oiiDJNZIkxJNNh2OJqOHxjGH82Jia514SrJQnjkP+sO3Y X-Received: by 2002:a17:902:442:: with SMTP id 60mr21220770ple.73.1548691854638; Mon, 28 Jan 2019 08:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691854; cv=none; d=google.com; s=arc-20160816; b=PVAK736DeWvFSQTBWH/e0JmYO1gFfTMTgkOzn+0Dq0YP0mIZ8lHwW+RA+m1lZ/Lsgk lg1r5lxiKSfF5S6Ca0+63ZKHzkqyGCiqII2z3NpZx2Bq6JJ56SIcpH8DFpdqyTWSjq6z MJCq8rA10SfA/GeORQujs9+qyy9vmgFrsQGdY3jVPbIoVbkP5OAQMLS4igW/NQ0mSPYI +sGlH6kc7s30akGEpr3PLsg0A90qaBD8TV0xUBYOfOinQUKFgDb9lvZWSdeZLSEq/aeR 6g4fjrd/K6BlTgzpP00ffbM39sGQCeINff4v5OaO8xL1F6rdOa6MyHn91w+CiSSmB9OM BKww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I9sHxDz7H90sh88GinAr/MT7nuo/12twfIFQcBhQL4E=; b=CamYnP/YKEJeG9wMbudTorv6PEK/y22PZTi6no25rLISA5qA1wtI3psA5w3WmRmKsU WUSZxYJEyqsamWjsWAuO5uNRPt/KNNO5t2vWhi6g/cBC0fx0iOiLnpFTJ/j81Eg5LNuB YhK2KZBHCMqEtEYiXjVH2dTl8eSNo4qzB2zRvAWeKvjSP/3iBC81FYZcStAW+tl0oWeP Lv/br3qd2w9K0TxZbA04qJnbaBPNwMacliCKNALQ5boLyh204qHnwn2hVLfBB2qb9Rik ro7ovDvhXK8bd41bbhnODR/p7LUmevDkHwrkC/JEmXrExkezkBKCA8CXMZH5sJcgIOBR Zh1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q7d5v6qC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si8729902pgh.132.2019.01.28.08.10.39; Mon, 28 Jan 2019 08:10:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q7d5v6qC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732383AbfA1QIW (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:59804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732343AbfA1QIO (ORCPT ); Mon, 28 Jan 2019 11:08:14 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8FC9D2147A; Mon, 28 Jan 2019 16:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691694; bh=ZBwx1Md24+q6FxcuEJQJWOqBm0slHwDH+/62QAZjWL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7d5v6qCe3ACCFoXubFoBMXL9MywnWq2AtdbS8JUF5E8/EUjmDFCyNdAWJAd5Aswn G6k4jYOp9yU9OkTukCWr4catevaaqepmzTHAjB6jHdB+AhHGxJzwLjmUieyzb0xQD2 JYNhRBhpBWcBbp5bMzSWsPmfiX87wtCHQ/pvzkmA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Luca Coelho , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 187/258] mac80211: fix radiotap vendor presence bitmap handling Date: Mon, 28 Jan 2019 10:58:13 -0500 Message-Id: <20190128155924.51521-187-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit efc38dd7d5fa5c8cdd0c917c5d00947aa0539443 ] Due to the alignment handling, it actually matters where in the code we add the 4 bytes for the presence bitmap to the length; the first field is the timestamp with 8 byte alignment so we need to add the space for the extra vendor namespace presence bitmap *before* we do any alignment for the fields. Move the presence bitmap length accounting to the right place to fix the alignment for the data properly. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/rx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 5e2b4a41acf1..51ad330bf8e8 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -142,6 +142,9 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local, /* allocate extra bitmaps */ if (status->chains) len += 4 * hweight8(status->chains); + /* vendor presence bitmap */ + if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) + len += 4; if (ieee80211_have_rx_timestamp(status)) { len = ALIGN(len, 8); @@ -197,8 +200,6 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local, if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) { struct ieee80211_vendor_radiotap *rtap = (void *)skb->data; - /* vendor presence bitmap */ - len += 4; /* alignment for fixed 6-byte vendor data header */ len = ALIGN(len, 2); /* vendor data header */ -- 2.19.1