From mboxrd@z Thu Jan 1 00:00:00 1970 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 849C414F62 for ; Fri, 8 Sep 2023 18:19:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15BC6C433B6; Fri, 8 Sep 2023 18:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694197192; bh=rZDQaoKKGAWzJqqNus001fL+/T4YtsVs/3RksbmNEuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8Am2oDp0M/TTejAuiTTJIgIdhJhxCgg3qMkcmoUb2yFMuGb9Uxfa3xgjOwog7SWL 1Y5PdDAsYH2OmFwddDEEYTU1tyfhpUAK2TJ6QkC7CNoTLxGq7/1B76ymVVqlpkGYVD dd6Z5+xPUTjP0+ep8XP3gsglFpv1sjymuSr0YmGK3a2dk9m7jpzOo5VErmdJNSUimQ 4C+1ItZhufj0pxV1J/RRzWJ3PeqVtthHCepw7aDmaGUJbyon1ezfRp7cA32obqvDvp /og31WVko+ASjC55WUSdZ53HuouJTGs039NW/Ys21ZTV4ts822gSkGk7JETGrtzUfx Uz3cnmKCRaetQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , syzbot+be9c824e6f269d608288@syzkaller.appspotmail.com, Sasha Levin , johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 11/15] wifi: mac80211: check S1G action frame size Date: Fri, 8 Sep 2023 14:19:14 -0400 Message-Id: <20230908181920.3460520-11-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230908181920.3460520-1-sashal@kernel.org> References: <20230908181920.3460520-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.131 Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit 19e4a47ee74718a22e963e8a647c8c3bfe8bb05c ] Before checking the action code, check that it even exists in the frame. Reported-by: syzbot+be9c824e6f269d608288@syzkaller.appspotmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/rx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 175ead6b19cb4..26943c93f14c4 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -3557,6 +3557,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) break; goto queue; case WLAN_CATEGORY_S1G: + if (len < offsetofend(typeof(*mgmt), + u.action.u.s1g.action_code)) + break; + switch (mgmt->u.action.u.s1g.action_code) { case WLAN_S1G_TWT_SETUP: case WLAN_S1G_TWT_TEARDOWN: -- 2.40.1