From nobody Fri Dec 19 19:15:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44E77C433FE for ; Thu, 13 Oct 2022 18:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbiJMSG1 (ORCPT ); Thu, 13 Oct 2022 14:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231388AbiJMSEQ (ORCPT ); Thu, 13 Oct 2022 14:04:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524D3659EF; Thu, 13 Oct 2022 11:04:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DB4D0B82052; Thu, 13 Oct 2022 17:59:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 391ABC433D6; Thu, 13 Oct 2022 17:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683996; bh=Rkj3yavmHq/l2/l7pqDSO4Z4hWCdKByuzZ0zgjaB5Qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvTnogA4IDMxNVqOz5W/Y6oEQDkC8+JKYqXusAdmb+BdxSqx21oIQh2srKDZhzVDj UtCkEe+TAOr2WQlbeBHGfY6yTThSbAJjUFavCqrEx2QYGUDLWww58/FEri8f+SKqJr uHrQr9jl9L6ji4Yo6SXVNiGTvuQWL2EcQrzpDrLE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?S=C3=B6nke=20Huster?= , Johannes Berg Subject: [PATCH 5.19 26/33] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Thu, 13 Oct 2022 19:52:58 +0200 Message-Id: <20221013175146.140719923@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175145.236739253@linuxfoundation.org> References: <20221013175145.236739253@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit 1833b6f46d7e2830251a063935ab464256defe22 upstream. If the tool on the other side (e.g. wmediumd) gets confused about the rate, we hit a warning in mac80211. Silence that by effectively duplicating the check here and dropping the frame silently (in mac80211 it's dropped with the warning). Reported-by: S=C3=B6nke Huster Tested-by: S=C3=B6nke Huster Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -4251,6 +4251,8 @@ static int hwsim_cloned_frame_received_n =20 rx_status.band =3D channel->band; rx_status.rate_idx =3D nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); + if (rx_status.rate_idx >=3D data2->hw->wiphy->bands[rx_status.band]->n_bi= trates) + goto out; rx_status.signal =3D nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); =20 hdr =3D (void *)skb->data;