From patchwork Thu Oct 13 17:52:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 2208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp410586wrs; Thu, 13 Oct 2022 11:06:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dFxF0jZOtacFEfb0JO3d+29dj0j+V7hr17Lhsj05tjzwwl9lPMpJaPHtLSF6xEb0MKhem X-Received: by 2002:a63:5144:0:b0:43b:ed4b:224 with SMTP id r4-20020a635144000000b0043bed4b0224mr977430pgl.594.1665684415416; Thu, 13 Oct 2022 11:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665684415; cv=none; d=google.com; s=arc-20160816; b=SXGYSEZIdjDZFjuV9IaZrcQP0TSBl76O6Xz/n7kW1035FxEY0CA+v+Kt4yX8uMmyZ5 a94n2RZ9CYgqSt3lnvDpL0NR7FwHQa/61+I6jOhCRu4ey3g/l+dKwThxlQNV9+ylwGxX M7h0MV+H+XiXnHLhAnaTKXkLPgigNe7c5y/WLvEZbMI/OJfIqGbWDYEF0qwZOGs7Jhec Mv5LsrwGOVfiITqTygfMd7XWja16jLRH6rXfio5E+d1dAWtmp0WvkMeXdDBEUlk+/66w Bn7INDaIlcwoXRiYj1KWwtCupUOFZpKqYFwHjRcxfBn9CAQ+znMv/Y3jRIaisNnFX5Wo Phyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sE9n5fneI6soQSlDKUac9znIuwjw8pX/rbeM/J2hr4E=; b=T/NLN+wvjVgBzVzmYSQqQ4pSX/HLmviu3ZQgqiK25gb+ueylg2GTWeX27gGoFHrmLL z0zojlrte4Fn53ia1ueKkKyCTBTxQpRMhYR8uJBcGRpvELeNuFcZPh1ehpHzNPTEOzG3 vmJeaiQXpztW6LplTGiq/Nw6nx8+gjNMDVA686SLHWy9Fa7oxKPQMRqswRnXAN/21+MQ IQn12t/tW7X+MzW9gzaXpofVC4+FSBOAtSDuUSDoI4lGHjvWblFodpks/bm9VrFtOZjC KTXWEbRyxxAPGaXn+sWzuocEBiE9rTHzNT0wMTi/cMUhEwdbemOxT0jmfr0L+MXk9mMX 4cvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qvTnogA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a17090a7ac300b0020ac15764f6si177187pjl.176.2022.10.13.11.06.43; Thu, 13 Oct 2022 11:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qvTnogA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbiJMSG0 (ORCPT + 99 others); Thu, 13 Oct 2022 14:06:26 -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_Huster?= , 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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746596701307569912?= X-GMAIL-MSGID: =?utf-8?q?1746596701307569912?= 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önke Huster Tested-by: Sönke 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 rx_status.band = channel->band; rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); + if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates) + goto out; rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); hdr = (void *)skb->data;