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 9A6208820 for ; Fri, 10 Mar 2023 14:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B311C4339C; Fri, 10 Mar 2023 14:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678459841; bh=dbNVXLNXLF9tmtDeLxwn0K7X2YQccU4s+X8cG+vzoOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpyKdKmN84GqAaSldtyzAizemBcsAABVWPwlP82gMWwZ82g0WZKuivwMtfMxiKqLp 4Td9jFjQUsroI8U9Yfjsr+XvtYoW9af6f370dZamXQ9ICOyTBtgZj5l3LXRhXKadnX UyCbXGXVxSVk/QqcpO0gax9guRakNoEDK8E7srvk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shayne Chen , Johannes Berg , Sasha Levin Subject: [PATCH 5.10 137/529] wifi: mac80211: make rate u32 in sta_set_rate_info_rx() Date: Fri, 10 Mar 2023 14:34:40 +0100 Message-Id: <20230310133811.317090111@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133804.978589368@linuxfoundation.org> References: <20230310133804.978589368@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Shayne Chen [ Upstream commit 59336e07b287d91dc4ec265e07724e8f7e3d0209 ] The value of last_rate in ieee80211_sta_rx_stats is degraded from u32 to u16 after being assigned to rate variable, which causes information loss in STA_STATS_FIELD_TYPE and later bitfields. Signed-off-by: Shayne Chen Link: https://lore.kernel.org/r/20230209110659.25447-1-shayne.chen@mediatek.com Fixes: 41cbb0f5a295 ("mac80211: add support for HE") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/sta_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index cee39ae52245c..d572478c4d68e 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2159,7 +2159,7 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate, static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) { - u16 rate = READ_ONCE(sta_get_last_rx_stats(sta)->last_rate); + u32 rate = READ_ONCE(sta_get_last_rx_stats(sta)->last_rate); if (rate == STA_STATS_RATE_INVALID) return -EINVAL; -- 2.39.2