From patchwork Mon Oct 24 11:29:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421744wru; Mon, 24 Oct 2022 05:21:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hVabx/lREkBIgN9P+GIg7Q3X1MGTABn11ywjODpFYbGFsX7vogkQ1eavbmEXRC1J3nbFO X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr27417911ejc.156.1666614067861; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614067; cv=none; d=google.com; s=arc-20160816; b=R55jkibuNWP1LGfPZZSRQSfLy0AXVYDe3THlGWxY4FEVuDxcx16jhXfGjOUFqDeDv/ JzhocpnRkqc+dLhM/eOzfqBjI6CYIyhCFSRjfm7IJPR1IGoyhvyyxpZNzljiBNlZKHwf I1pDE+g4JMfxCXYXtR9Lzx41rcgMspUoMOt45YeH/YoGlfzhkstck8C3IaA6gnrx3Lsx 92ctdAFkM0Aqlks1JTxjn2vU5Vkf3XmdEIUZUMrTbHAiQVD/1odPmlqh0H4NYeZ/jThH lFL+It7aL2Ds3UJAPHo9Zf5I4zZFzHcL3vV4BgFJddYSTIlkhXdOlHVSlPF9t4vCqDKf YbjQ== 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=wvsIiPxMt4KilhM2Co755tGxIhX5mC1Vj0QnSB5WorI=; b=MOvys++j49RzgXDsvGfavrj7veOTOdJ9QjeIyGL+n2+9q8/4Y90qrhAcYTsCKN1wU/ 1hnhWmdA8zaUGn6Us6vNAGYCPgIscwXQXtVDyanAAD4KCYD1ERzkfde44abT0AbQoUqZ dZuBhAKbO1sWnJquJrWCRYw4Z3EM/eeXN1HUpBfdtVvOdl61IIubmR2ah4Qh4U7UUIU8 zRLIBiG6PRb6ix/bgNi7UFdvuM7XWRyFx2FZzoVUY+hHT2HxtKpBTwqnNvNfviNuiI1b RxWIccwHZGY0C/ZnTG5G+YfnWE/k74DL1/TfPSfYQe+8mfnJY5O53yBmEJLPv/Qovbao qHHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ldUVLxGo; 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 i7-20020a1709064fc700b0078d6418dcb8si30958940ejw.456.2022.10.24.05.20.43; Mon, 24 Oct 2022 05:21:07 -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=ldUVLxGo; 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 S233184AbiJXMRN (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbiJXMPN (ORCPT ); Mon, 24 Oct 2022 08:15:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7558052B; Mon, 24 Oct 2022 04:56:00 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1208B6126B; Mon, 24 Oct 2022 11:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25222C433C1; Mon, 24 Oct 2022 11:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612547; bh=kQIWC0ZgBV/lLuQ8oDBM12FE6Kn6eno2vD1KsA9VkqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldUVLxGorLc03Lz+J/5lB0KVih3+Y3d3KedVmHDyYCxSgMNyVTLMmdH359ztOharK fhQOD8IxIJ81konEVqX/wB3mSItFUT7WO1K6aygSeAQZSllpP1J+zOFNwUDK4fqH0D GnUJ8s0QRnTFj6jPB7P7Wvmi4Q3vxpsHQ8bcyfR0= 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 4.19 029/229] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:08 +0200 Message-Id: <20221024113000.070441529@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747571513003951475?= X-GMAIL-MSGID: =?utf-8?q?1747571513003951475?= 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 @@ -3270,6 +3270,8 @@ static int hwsim_cloned_frame_received_n rx_status.band = data2->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]); memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));