From patchwork Thu Oct 13 17:52:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 2139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp404980wrs; Thu, 13 Oct 2022 10:56:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xG5NItX6bwMgrQipdEMtuvVBrbAcTkcFNaeweSXyjXxhgZPE6QAiXZ6pfFnBufFI/ZHwg X-Received: by 2002:a63:2b48:0:b0:434:eb45:9c6a with SMTP id r69-20020a632b48000000b00434eb459c6amr909424pgr.508.1665683790593; Thu, 13 Oct 2022 10:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665683790; cv=none; d=google.com; s=arc-20160816; b=D7uvOo8sfWWq5mAmH2wE2WMENrXIpLZO6yBHB6s8BrMjhTS0gfwlWmbj3Yl9ymIT/8 jNdb7PrVI8hkOaFS19CSONGiBvCffzY57lF/5Gi++4yp3KxKela7q4LPjbMTQ5SdCGl1 7+BLVjPeXYvNTOoSd7YQFgQBaswIaIVqQWafYW6Et1o2YyBmkSvOfHwTWzTfu/ACS7In FI8iYqWNwA/fJyjbBqX83oC7eSV6rXKg/vlYblo4BpPVG22lCMGqysFaaeUXXr8CFhsI eow3LiqO2eVHCjGkjn1PK3uERX1AAXIU/wO+svQYIK5BmaxUpGlsJ2i7Yp5ORHMer3nI biWQ== 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=lCvAkOjqYDuR7ijhEzPpcGOuHJYz5xbRg7q1Mz7AlOc=; b=nN1+QAuLgrGWUbRKOmPBIojYv0lcsWrqLQQ3+jci7dS0NW8wYnaHw6Hq+CMPUUrWDN 49mETmnxyICDH32MKiwkuyE5q52FQ/6fLx0oAIuEl9MiTJ9rOaJuZrk6lizZ43Be/45Q J1uvO9IVhQ48ATOLglL0Q9ZVAEi0DsOCa2u/GEoSpWX2jTCsSoln66wEwJfVpAace0/L 4waon2M/TMk0V3TkVyWQI9vTfJfvrc4WQEmxxmO+QdsTUGxvkVz4IGKwL6L4Y13ERBSB lQ5CIAvVYf/4cqpCjAohGMohAF01FAONmfn1IngLWxYlinhTgqezbp6bYRNvKCbsIfCJ ma9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DPCa+U7/"; 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 y2-20020a1709027c8200b0017d8a86e524si298567pll.506.2022.10.13.10.56.18; Thu, 13 Oct 2022 10:56:30 -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="DPCa+U7/"; 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 S230027AbiJMRzq (ORCPT + 99 others); Thu, 13 Oct 2022 13:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbiJMRys (ORCPT ); Thu, 13 Oct 2022 13:54:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9372315B303; Thu, 13 Oct 2022 10:53:57 -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 8461861901; Thu, 13 Oct 2022 17:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97B18C433C1; Thu, 13 Oct 2022 17:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683636; bh=pOLv8B3166I/rKsvitiotq67NdZbWnlOIsHPBxJaJbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DPCa+U7/FgwPB38T3TRo9sgnqRACYdtm13J6W6XxO6nyqvYj+w0rGQkn5AZJUbS92 cN2M+uI/TVn3GRXxBzLyDTUGG6l5fJI1wtmTTgCIfkC2GLhIACgoZN/WNTSFIS8+P/ vAUWjsDcuOVhoHlDipFQLdDdwqxWf5/6D4VEVh+g= 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.4 35/38] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Thu, 13 Oct 2022 19:52:36 +0200 Message-Id: <20221013175145.415728357@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175144.245431424@linuxfoundation.org> References: <20221013175144.245431424@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?1746596046451160978?= X-GMAIL-MSGID: =?utf-8?q?1746596046451160978?= 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 @@ -3411,6 +3411,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]); hdr = (void *)skb->data;